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

fcheck() always return 1

Hi,

I am using Flash file system for interfacing sd card using SPI. MCU is LPC2138.
Every thing is working fine except for fcheck() which always returns 1. I am using the latest versions MDK4.54 and RL4.13.
Below is the idea of problem:

int main () {

FILE *myFile;
char str[50];
Initialize();

if(finit("M0:") == 0) {
        UART0_sendstring("SD card Init ok\r\n");
        sprintf(str, "Free Space =  %d\r\n", ffree("M0:"));
        UART0_sendstring(str);

        sprintf(str, "Fanalyse =  %d\r\n", fanalyse("M0:"));
        UART0_sendstring(str);
        if (fanalyse("M0:") > 50)  {
        UART0_sendstring("Defragmenting the Sd card.\r\n");
        fdefrag ("M0:");
        }
        sprintf(str, "Fcheck =  %d\r\n", fcheck("M0:"));
        UART0_sendstring(str);

        myFile = fopen("M0:\\Files\\welcome.txt","w");
        if(myFile != NULL) {
        fputs("Hello My name is salman. What is your name?\r\nI am going to the airport.\r\nWould you like to come with me.", myFile);
        }
        fclose(myFile);
}
  else UART0_sendstring("SD card Init Failed\r\n");


while(1);

OUTPUT:

SD card Init ok
Free Space = 126189568
Fanalyse = 0
Fcheck = 1

One more thing, Previously i was using MDK4.21 and RL4.13 and fcheck() was working fine.
Upgrading the MDK seems to have caused the problem.

0