Unable to mount the sd card in lpc1768

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to mount the sd card in lpc1768

1,047 Views
rahulgusai
Contributor I

I am working on file system middleware component to interface the SD card with lpc1768.I double checked all the resource requirements and configuraton of all the components required.Still, fmount function returns the fsMediaError and is unable to amount the memory drive.I have no clue of the issue. Can anyone please help me out on this ?

Am using the code given below to initialize and mount the sd card.

void sd_init(void) {fsStatus stat; SystemInit();         LPC_GPIO2->FIODIR=0XFFFFFFFF;   printf ("Initializing and mounting enabled drives...\n\n");    /* Initialize and mount drive "M0" */   stat = finit ("M0:");   if (stat == fsOK) {     stat = fmount ("M0:");       if (stat == fsOK) {        LPC_GPIO2->FIOPIN=0xfffffff1;                         printf ("Drive M0 ready!\n");     }     else if (stat == fsNoFileSystem) {         /* Format the drive */      LPC_GPIO2->FIOPIN=0xfffffff2;                         printf ("Drive M0 not formatted!\n");      }     else if (stat==fsMmediaError){       printf ("Drive M0 mount failed with error code %d\n", stat);      LPC_GPIO2->FIOPIN=0xfffffff3;                 }   }   else {     printf ("Drive M0 initialization failed!\n");   }  printf ("\nDone!\n");                 }
Labels (4)
Tags (2)
0 Kudos
1 Reply

590 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Rahul Gusai,

    If you want to make the fatfs work with SD card, you must to check these points:

1. Hardware connection.

  Check all the pins which used to communicate with the SD card, check the SD card connection is correct, and the external circuit is correct.

  I don't what the SD card board you are using, it is from official or your own designed board?

  You can refer to this post to check the hardware:

LPC43S67 periph_sdmmc example error 

2. Code should match with your hardware

   Check you configure the correct pins in your software, especially the SD card module code and the according pin code.

   Please also tell us, what the sd card code you are using? Did you wrote it by your self?

   You can check the SPI wave, whether it send out the correct command.

Wish it helps you!

If you still have question, please let me know!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos