SD Card SPI + MFS?

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

SD Card SPI + MFS?

Jump to solution
2,104 Views
EDesigns
Contributor I

Hello,

 

I'm using the M52259EVB evaluation board and am successfully initializing a microSDHC card with SPI.

 

Is it possible to use the MFS driver to read the FAT32 file system contents of the SD card?

I'm trying to open the device that I will be installing the MFS onto but it keeps crashing when i call

     fopen("spi0:", 0)

0 Kudos
1 Solution
708 Views
PetrM
Senior Contributor I

Hello,

 

you need to have a look at BSP of one of the boards, that already supports SDCARD driver, like twrmcf52259 (same processor). There are several files/declarations/initializations that need to be added to m52259evb's BSP - sdcard/sdcard_spi driver, init_sdcard0.c etc.

 

PetrM

View solution in original post

0 Kudos
5 Replies
708 Views
PetrL
NXP Employee
NXP Employee

Hi,

 

the code is crashing because you spi driver is not prepared cooperate with MFS directly. However you can use SD card driver for this task.


See SDCARD example in "C:\Program Files\Freescale\Freescale MQX 3.6\mfs\examples\sdcard" and SD card documentation in IO Guide "C:\Program Files\Freescale\Freescale MQX 3.6\doc\mqx\MQXIOUG.pdf" .

 

If you port the example to your system you should be able to access FAT32 on SD card.

 

Regards,

Petr

0 Kudos
708 Views
EDesigns
Contributor I

I've attempted to port the code over and I'm still encountering the same problem as I was before.

It keeps crashing on this line:

               sdcard_handle = fopen("sdcard:", 0);

 

I'm kind of confused on where sdcard: is coming from. Should it be spi0: ?

0 Kudos
709 Views
PetrM
Senior Contributor I

Hello,

 

you need to have a look at BSP of one of the boards, that already supports SDCARD driver, like twrmcf52259 (same processor). There are several files/declarations/initializations that need to be added to m52259evb's BSP - sdcard/sdcard_spi driver, init_sdcard0.c etc.

 

PetrM

0 Kudos
708 Views
EDesigns
Contributor I

Thank you PetrM! I was able to port it over rather easily and succesfully!

0 Kudos
708 Views
EDesigns
Contributor I

PetrL,

 

Thank you for your response. I did look at those SDCard examples and the section in the I/O user guide. However, the SD Card drivers are not compatible with the 52259EVB evaluation board.

 

I am having troubles porting it over because the _io_sdcard_install function uses _io_dev_install_ext which uses the SD card functions that are not SPI.

0 Kudos