Kinetis TWR-K40D100M SD card project examples?

cancel
Showing results for 
Search instead for 
Did you mean: 

Kinetis TWR-K40D100M SD card project examples?

800 Views
efrencabebe
Contributor III

Hello,

I've been having trouble setting up a basic SDHC card read / write with my TWR-K40D100M tower system. Does there exist any sample code for KDS / CW10.6.4 which utilizes CMSIS that displays this functionality?

Thanks,
Efren

7 Replies

433 Views
efrencabebe
Contributor III

Thanks all,

Solved my issue!

0 Kudos

433 Views
mjbcswitzerland
Specialist V

Hi

See:
- http://www.utasker.com/kinetis/TWR-K40D100M.html
SDHC solution for this board which builds with KDS and CW10.x (or IAR, Keil, Rowley, Atollic, Green Hills, etc.)
It doesn't use CMSIS but I don't see that this should be that relevant.

Below I have added a reference to the advanced features offered by utFAT and it interface.

Regards

Mark
Kinetis for professionals: http://www.utasker.com/kinetis.html

Hello, world... KINETIS
SD-card V2 - High Capacity

Disk D mounted

Serial number: 00
Software version V1.4.012
Device identification: KINETIS K40

     Main menu
===================
1              Configure LAN interface
2              Configure serial interface
3              Go to I/O menu
4              Go to administration menu
5              Go to overview/statistics menu
6              Go to USB menu
7              Go to I2C menu
8              Go to utFAT disk interface
9              FTP/TELNET client commands
a              CAN commands
help           Display menu specific help
quit           Leave command mode
8


  Disk interface
===================
up           go to main menu
info         utFAT/card info
dir          [path] show directory content
dird         [path] show deleted directory content
dirh         [path] show hidden content
infof        [path] show file info
infod        [path] show deleted info
cd           [path] change dir. (.. for up)
file         [path] new empty file
write        [path] test write to file
mkdir        new empty dir
rename       [from] [to] rename
trunc        truncate to [length] [path]
hide         [path] file/dir to hide
unhide       [path] file/dir to un-hide
prot         [path] file/dir to write-protect
unprot       [path] file/dir to un-protet
print        [path] print file content
del          [path] delete file or dir.
undel        undelete [name]
format       [-16/12] [label] format (unformatted) disk
fformat      [-16/12] [label] full format (unformatted) disk
re-format    [-16/12] [label] reformat disk!!!!!
re-fformat   [-16/12] [label] full reformat disk!!!!!
sect         [hex no.] display sector
help         Display menu specific help
quit         Leave command mode
dir
Directory D:\

---- 26.10.2015  12:00 [DIR]            dir1
---A 26.10.2015  12:00              256 M21.txt
---A 26.10.2015  12:00            13336 software.bin
2 files with 13592 bytes
1 directories, 4115922944 bytes free
D:\>dir dir1
Directory D:\dir1

---- 26.10.2015  12:00 [DIR]            dir_x
---A 26.10.2015  12:00             1024 long_file_name_1234.bin
---- 26.10.2015  12:00 [DIR]            dir_next
1 files with 1024 bytes
2 directories, 4115922944 bytes free

D:\>infof M21.txt
File: M21.txt is LFN
Starting at entry 0x03 in sector 0x00003dc5 (cluster 0x00000002)
First object from 1
Data = 0x41 0x4d 0x00 0x32 0x00 0x31 0x00 0x2e 0x00 0x74 0x00 0x0f 0x00 0x7b 0x78 0x00 0x74 0x00 0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0x00 0x00 0xff 0xff 0xff 0xff
SFN File located at entry 0x04 in sector 0x00003dc5 (cluster 0x00000002)
Data = 0x20 0x00 0x0e 0x12 0x12 0x09 0x10 0x1f 0x2f 0x00 0x00 0x20 0x00 0x00 0x00 0x60 0x5a 0x47 0x5a 0x47 0x00 0x00 0x00 0x60 0x5a 0x47 0x04 0x00 0x00 0x01 0x00 0x00
SFN name (archive) =  ......./.. Alias CS = 0x7b
File length = 256 starting in sector 0x00003dd5 (cluster 0x00000004) FAT sector 0x0000005f offset 0x04

D:\>sect 3dc5
Reading sector 0x00003dc5
 0x4e555242 0x0000004f 0x08000000 0x60000000 0x475a475a 0x60000000 0x0000475a 0x00000000 0x69006441 0x31007200 0x0f000000 0xffffe400 0xffffffff 0xffffffff 0x0000ffff 0xffffffff
 0x0a010020 0x0c161d0c 0x1000002f 0x60000000 0x475a475a 0x60000000 0x0003475a 0x00000000 0x32004d41 0x2e003100 0x0f007400 0x00787b00 0x00000074 0xffffffff 0x0000ffff 0xffffffff
 0x120e0020 0x1f100912 0x2000002f 0x60000000 0x475a475a 0x60000000 0x0004475a 0x00000100 0x6f007341 0x74006600 0x0f007700 0x0061ed00 0x00650072 0x0062002e 0x00000069 0x0000006e
 0x00090020 0x181e0803 0x2000002f 0x60000000 0x475a475a 0x60000000 0x0006475a 0x00003418 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
 D:\
                

433 Views
BlackNight
NXP Employee
NXP Employee

Hi Efren,

I recommend that you have a look at the uTasker solution. And as Mark says: CMSIS should not matter for your question at all (the question then would be for which of the CMSIS parts you are looking for: core, pack, drivers, ...).

I have a very simple bare metal TWR-K40D100M project for KDS V3.x on GitHub here:

mcuoneclipse/Examples/KDS/TWR-K40D100M/TWR_K40D100M_FatFS_BM at master · ErichStyger/mcuoneclipse · ... 

It uses the open source FatFS as file system (FatFs - Generic FAT File System Module ) and communicates over the OSBDM serial-2-uart:

pastedImage_202.png

It uses Processor Expert with additional components (see McuOnEclipse - Browse /PEx Components at SourceForge.net  and https://mcuoneclipse.com/2014/10/21/mcuoneclipse-releases-on-sourceforge/ ) and you can use it with an Eclipse version (KDS, CodeWarrior, etc). FatFS nicely fits as well with a real time kernel, and most of the time I use it in combination with FreeRTOS. But you could use any RTOS of your choice too.

In any case, I have attached the full project with all sources so you can have a look.

I hope this helps,

Erich

433 Views
efrencabebe
Contributor III

Hi Erich,

Thanks for the reply!

I am having trouble importing your TWR_K40D100M_FatFS_BM.zip project into KDS. I noticed that the project itself does not have a *.wsd file to import. What are the steps necessary in importing this project?

Thanks,
Efren 

0 Kudos

433 Views
BlackNight
NXP Employee
NXP Employee

Hi Efren,

why would you need a .wsd file? .wsd file(s) are not necessary/needed.

Unpack the zip file to your hard disk.

use the menu Import > Existing Project into Workspace and point to the location where you have unzipped your project.

That's it.

If you want to have the full Processor Expert components too, then follow the steps described in https://mcuoneclipse.com/2014/10/21/mcuoneclipse-releases-on-sourceforge/  prior importing the project into your workspace.

I hope this helps,

Erich

0 Kudos

433 Views
elisamejia
Contributor III

Hi Erich,

Do you happen to have an example for the SDHc configuration that doesn't use ProcessorExpert?

Regards,

Elisa

0 Kudos

433 Views
BlackNight
NXP Employee
NXP Employee

Hi Elisa,

no, I don't have that, but have a look at the examples which are part of the Kinetis SDK.

Erich

0 Kudos