We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am trying to interface SD card with LPC1768 MCU using CMSIS file system middleware. I have configured the system in SPI mode using memory card drive(M0:).Initialization function returns the desired fsOK value.But the following function i.e. amount keeps on returning fsMediaError.What could be the issue ?
Here is the code:-
#include"lpc17xx.h" #include"rl_fs.h" fsStatus stat; int main(void) { LPC_GPIO2->FIODIR=0XFFFFFFFF; stat = finit ("M0:"); \ if (stat==fsOK) { stat = fmount ("M0:"); switch(stat){ case fsOK: LPC_GPIO2->FIOPIN= 0xfffffff1; break; case fsUninitializedDrive: LPC_GPIO2->FIOPIN= 0xfffffff2; break; case fsInvalidParameter: LPC_GPIO2->FIOPIN= 0xfffffff3; break; case fsInvalidDrive: LPC_GPIO2->FIOPIN= 0xfffffff4; break; case fsDriverError: LPC_GPIO2->FIOPIN= 0xfffffff5; break; case fsMediaError: LPC_GPIO2->FIOPIN= 0xfffffff6; break; case fsNoMedia: LPC_GPIO2->FIOPIN= 0xfffffff7; break; case fsNoFileSystem: LPC_GPIO2->FIOPIN= 0xfffffff8; break; } }