Douglas Triman

TWR-LCD demo program not reading uSD card

Discussion created by Douglas Triman on Mar 10, 2012
Latest reply on Mar 14, 2012 by Douglas Triman

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.

Outcomes