Hi,
I've been using a HSC12X microcontroller for a couple months now and after setting up most of the basic functions, I am stuck with a stupid error with the SD card that I can't seem to understand and overcome. I am using a HCS12X development board (http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=EVB9S12XDP512&fsrch=1) and I soldered a connector to plug in a Microchip PicTail SD Card board (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en537238). I decided to implement with that board because I had it working in the past so I could rely on it.
I am using the SPI1 port on pins 2,3,4 and Port B (pin 0 at pin 32) for the /SS.
I use the code posted above in this post by Jim to implement the SD card basic functionality. I have also tested with other codes, such as the one provided on
http://elm-chan.org/fsw/ff/00index_e.html with the same result.
Here is my issue:
I have checked with a scope that the signals are sent as follow:
Wait ~1 ms
Send 80 CLK with /SS High and 0xFF on MOSI, (CLK idle low)
then taking /SS low, wait ~1 ms
Send CMD0 (0x40, 0x00, 0x00, 0x00, 0x00, 0x95)
Send 0xFF until receiving an answer
(MOSI and MISO are both Idle high)
The answer is ALWAYS 0x03 which means SD card is IDLE but "Erase RESET" flag is set. The card won't listen to future commands and the answer is the same no matter how often I send CMD0. I have tried with different SD cards (SD 512MB, SD 1GB, MMC 16MB), all with the same result.
If I put the same PicTail board on the microchip Explorer 16 board, it works perfectly and even writes empty data files on the FAT16 file system. The connector used to connect to the Explorer 16 is different than the one used on the HCS12X eval board since it is 3.3V instead of 5V but the conversion is done properly on the PicTail board, and the signals all look perfect on the scope.
also important to note, I have tried SPI CLK speed from 125kHz to 2 MHz without better success.
Has anybody ever had this issue? Any hints?
Thank you,
Olivier
Message Edited by OlivierL on
2009-02-11 12:17 AM