Using SDcard in SPI mode on FRDM K22-F

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using SDcard in SPI mode on FRDM K22-F

2,920 Views
vítorpereira
Contributor III

Hi,

I want to implement a FAT system to use an SD card on the FRDM K22-F, in SPI mode. The component on Processor Expert used to implement it is FAT system is the FatFile_System. However, this component is linked specifically and only to the FatFsMemSDHC and its inherited SDHC_LDD components, which perform the operations through the physical layer, and they are meant to use in SD mode. Therefore,  FatFile_System and SynchroMaster component can't work together. As the FRDM board is not wired to work in SD mode, I couldn't just use the FatFile_System component as it is(and I want to work in SPI mode anyway). How can I do it? And please, if there's any misconception in my thoughts above, let me know.

 

Vítor Pereira

Labels (1)
9 Replies

2,295 Views
vítorpereira
Contributor III

Hey guys, I did it! It was actually pretty simple! Thanks!

Vítor Pereira

2,295 Views
ra9623
NXP Employee
NXP Employee

Congratulations.  Glad to help.

Best Regards,

Joe

0 Kudos

2,295 Views
BlackNight
NXP Employee
NXP Employee

Hi Vitor,

I'm using FatFS with the FRDM-K22F in normal SPI mode and Processor Expert, see https://mcuoneclipse.com/2015/10/07/added-micro-sd-card-socket-to-frdm-k22f/ .

pastedImage_2.png

The project is available on GitHub (mcuoneclipse/Examples/KDS/FRDM-K22F/FRDM-K22F_FatFS at master · ErichStyger/mcuoneclipse · GitHub ), but I have attached it for your convenience here as well. Note that the project is using open source Processor Expert from SourceForge (see https://mcuoneclipse.com/2014/10/21/mcuoneclipse-releases-on-sourceforge/  and McuOnEclipse - Browse /PEx Components at SourceForge.net ).

I hope this helps,

Erich

0 Kudos

2,295 Views
vítorpereira
Contributor III

Hi Erich, I downloaded the project and I saw you used KSDK on your project. Is it essential?

Also, I'm a little bit confused: do I have to use SychroMaster methods myself directly or it is used by the FAT_FileSystem under its functions without me noticing it?

Vítor Pereira

0 Kudos

2,295 Views
BlackNight
NXP Employee
NXP Employee

Hi Vitor,

No, it is not using the Kinetis SDK, as the version is set to 'none':

pastedImage_0.png

That component is only there to make the bridge for either 'none', SDK v1.3 or SDK v2.0 and to provide the necessary wrappers.

As you should see with the example, you do not need to use the Synchromaster methods directly: simply use the FatFS functions.

In that example I'm using FreeRTOS because it makes the application scalable. But if you want to run it baremetal, here is another example (well, for a different board, but you could use the same thing for the FRDM-K22F and KDS):

https://github.com/ErichStyger/mcuoneclipse/blob/master/Examples/CodeWarrior/TRW-K60N512/TWR-K60N512...

Erich

2,295 Views
ra9623
NXP Employee
NXP Employee

Vitor,

I think I can help you with this.

Which version of KSDK are you using?  I have a FRDM-K22F at home using version 1.3.  I have it working with SD Card in SPI mode.  I can share source with you but it's on my personal computer at home so it'll have to wait until tomorrow.

Best Regards,

Joe

0 Kudos

2,295 Views
vítorpereira
Contributor III

Hi Joseph,

I'm not using KSDK, but even so what you did could be of immeasurable value, since you somehow turned the problem aorund, isn't it? And no problem, I can wait until tomorrow.

Thanks a lot, Joseph!

Vítor Pereira

0 Kudos

2,295 Views
ra9623
NXP Employee
NXP Employee

Vitor,

If Erich has already answered your questions then disregard.

In case you're still interested I'm attaching a project that uses FAT with SD in SPI mode. It's interrupt based but I've used with edma as well. It's a KSDK 1.3 ProcessorExpert project.

Sorry, I don't know about SynchroMaster so if you need more help with that then I suggest asking Erich!

Best Regards,

Joe

2,295 Views
vítorpereira
Contributor III

Hi Joe, thanks for sending me your project. I'll take a look. I think I have now some material to get some help. Thanks!

Vítor Pereira

0 Kudos