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

MCI fails to initialze on SD Card 1/2 of the time

The previous thread is now marked read only, so I'm posting the workaround here. Add one line to the init driver:
/*-----------------------------------------------------------------------------

* Initialize the Flash File System

*----------------------------------------------------------------------------*/

void initFS (void) {

U32 retv;

retv = finit(NULL);

while ((retv = finit (NULL)) != 0) { /* Wait until the FS is ready */

if (retv == 1) {

bugOut ("\nSD/MMC Init Failed");

bugOut ("\nInsert Memory card and press key...\n");

while (getkey () == 0);

}

else {

bugOut ("\nSD/MMC Card is Unformatted");

strcpy (&in_line[0], "AEGIS\r\n");

cmdFormat (&in_line[0]);

}

}

}

now it works 100%

Parents Reply Children
  • The loop returns that it failed, and then tells the user to put in the SD card and try again. The SD card is already in, and is fine, so it should not have failed and not alerted the customer to a problem that doesn't exist. That's a guaranteed customer service call. The problem is discerning when the finit call is just fubar or when the card really isn't in and the customer does need to be notified. There are other solutions, I just found this one to be the simplest.