TWR-LCD demo program not reading uSD card

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

TWR-LCD demo program not reading uSD card

707件の閲覧回数
talktrn
Contributor I

I've been developing code on the TWR-LCD without problem, until I added the microSD card.  So I went back to the example programs provided with the board.

 

The Demo for TWR-LCD-JM128 includes JM128_RevA_noBL_ECUI_SPI project for CW6.2 Processor Expert.  Every example works in this demo except for the SD Card demo.  It's screen is presented, and it says "initializing SD card driver" and hangs there forever.  Insert uSD (8GB) card, nothing happens.  Remove the card, "Card Present" checkbox briefly is X'ed, then it's empty and no other messages appear.  Insert card and now it says "reading directory" and hangs when I touch "DIR" button.

 

So I started going through the Freescale code, and have scope on the uSD lines -- 1st surprise is that the baud rate for SPI is way off at high speed.  As I look through the code, I find:

 

#define SD1_SPI_SetSlowMode()              (void)SM2_SetBaudRateMode(0) /* max 375kbps */
#define SD1_SPI_SetFastMode()              (void)SM2_SetBaudRateMode(1) /* max 12Mbps */

 

These are clearly reversed!!  So I fix that, and behold the scope shows correct initial clock rate.  But then as I continue reviewing code I find more and more "issues".  What gives?

 

Is the uSD demo on TWR-LCD JM128 supposed to work?  I've tried multiple known-good uSD cards to no avail.

ラベル(1)
0 件の賞賛
返信
2 返答(返信)

516件の閲覧回数
talktrn
Contributor I

Update:  the following lines not shown correclty in previous message, extracted from module SD1.c generated by Processor Expert, CW6.3

 

original Processor Expert code:

//#define SD1_SPI_SetFastMode()              (void)SM2_SetBaudRateMode(0) /* max 375kbps */
//#define SD1_SPI_SetSlowMode()              (void)SM2_SetBaudRateMode(1) /* max 12Mbps */

should be:

#define SD1_SPI_SetSlowMode()              (void)SM2_SetBaudRateMode(0) /* max 375kbps */
#define SD1_SPI_SetFastMode()              (void)SM2_SetBaudRateMode(1) /* max 12Mbps */

Once these lines are corrected, the baud rate on uSD card is correct during initialization.

0 件の賞賛
返信

516件の閲覧回数
talktrn
Contributor I

Code correction shown above does not solve problem, only straightens out the incorrect initial baud rate (per uSD card spec).  The SD Card Demo still does not initialize or read the directory.  Has anyone ever seen this thing work?

0 件の賞賛
返信