SD Card SPI + MFS?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

SD Card SPI + MFS?

跳至解决方案
3,133 次查看
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 项奖励
回复
1 解答
1,737 次查看
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 项奖励
回复
5 回复数
1,737 次查看
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 项奖励
回复
1,737 次查看
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 项奖励
回复
1,738 次查看
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 项奖励
回复
1,737 次查看
EDesigns
Contributor I

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

0 项奖励
回复
1,737 次查看
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 项奖励
回复