This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SPI SD Memory problem with LPC1768 and Keil Flash File sysyem

Hi all,

I am using SD Memory interface in SPI mode with LPC1768 and using the keil Flash file system as Memory Card Driver0. The SD Memory used is 2GB SD1.0 complaint.

I have customised the SD_File code of MCB1700 for muy application.

File reading, writing,folder creation, everything is working fine.
But some times it shows error as "Insert Memory Card" or "Memory card Unformetted".

I have checked the Detect switch and write protect switch signals they are working correctly.

when I debugged, the function finit is calling the function checkmedia. checkmedia is detecting the switch state as card inserted, but after that i am not able to debug what it is esnding to the card and what it is expecting from the card. Finally return from the finit is 1 or 2 duo to which it is displaying the above said errors.

I have checked the voltage levels of the SSP signals they are all working at level 1 is above 3 Volts.
I am not understanding why this is behaving like this. It is working some times and not working some times.

Please suggest to resolve this problem.

regards
Lingaraju

  • Just got done debugging the Keil SDIO sample app intergrated into a test project. Found the following issues:

    (1) File Config.c : The File System 'CPU Clock Frequency' was set to 60MHz instead of 120 MHz, which was causing no detect messages as you describe above.

    (2) SDIO driver I was using from Keil FlashFS directories instead of sample project was checking pin 15 instead of 13 on GPIOH (STM32f2xx eval board in SD mode - obviously).

    (3) SDIO Init() was not being called unless 'FAT Journal' was selected in memory card 0 selection. finit() would fail wwith error 1. Need to investigate further

    (4) SDIO driver Errors (from 04-08 code source):

    0 = Success 1 = Failed to initialize or no card. 2 = Failed to read or invalid MBR 3 = Failed to read or Invalid Boot Record. 4 = Invalid FAT table.

    Good Luck.

  • Also,

    Repeated install/release from SD card holder of SD Card while debugging seems to cause corruption on the Card. Since the card is not properly unmounted this is not a big suprise but need further investigation to try to make more robust - if possible.

    finit() and fflush() work fine - all that has been tested so far....