SD CARD + TWRLCD + TWRMCF52259

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

SD CARD + TWRLCD + TWRMCF52259

跳至解决方案
2,874 次查看
M_ttferrari
Contributor III

HI, I'm trying to find the way to read/write an SD card on TWRLCD handled by TWRMCF52259. I'm following the sdcard example of MQX 3.6.1 (msf/examples/sdcard), the example work fine until line where it need be open with fopen("sdcard:",0) -> this function return a NULL handle, so the sd_task, then, is blocked.

 

I don't know where continue finding out... Any ideas about what it is happening??

 

Thanks 

0 项奖励
回复
1 解答
1,929 次查看
M_ttferrari
Contributor III

The problem was solved setting as input with internal pullups the PORTE [4:7] of MCF51JM on TWRLCD.

 

Now the example work fine.

 

Thank you for your aswer PetrM...

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,929 次查看
PetrM
Senior Contributor I

Hello,

 

this is standard behaviour when SD card cannot be initialized (mostly due to SPI/eSDHC communication problems).

I'm suggesting to run it without TWRLCD. If that works, the problem is in SPI connections.

On twrmcf52259, the QSPI is connected to both SPI0 and SPI1 pins on elevator port B. Please check all those connections if they interfere with something on LCD board (check also LCD jumpers/switches).

 

PetrM

 

0 项奖励
回复
1,929 次查看
M_ttferrari
Contributor III

Hi PetrM

 

If I run it without TWRLCD I won't have a SD card Slot. 

 

LDC switch configurations are:

 

SW1/JP1=OFF, SW1/JP2=ON, SW1/JP3=ON, SW1/JP4=ON, SW1/JP5=ON, SW1/JP6=OFF, SW1/JP7=ON, SW1/JP8=OFF

 

I'm suspecting that some defines like BSP_SDCARD_GPIO_CS, BSP_SDCARD_GPIO_DETECT, BSP_SDCARD_GPIO_PROTECT and BSP_SDCARD_SPI_CHANNEL all of these define are in twrmcf52259.h, but I don't know where the project is doing refece to this file because when I search "twrmcf52259.h" inside the project I don't have any results.

 

By other hand, demo.c has some conditional compiles, one of them is #if defined BSP_SDCARD_GPIO_CS at least that I define this macro in demo.c, this conditional compilation line doesn't compile even if I include twrmcf52259.h a quite rare situation, doesn't it?

 

So, I don't know if I need BSP_SDCARD_GPIO_SC or not and, I don't know too, what is it happening with QSPI...

 

Matt

0 项奖励
回复
1,930 次查看
M_ttferrari
Contributor III

The problem was solved setting as input with internal pullups the PORTE [4:7] of MCF51JM on TWRLCD.

 

Now the example work fine.

 

Thank you for your aswer PetrM...

0 项奖励
回复