AnsweredAssumed Answered

STM3210E-Eval + sdio + fatfs problem

Question asked by lemel on Jul 10, 2014
Latest reply on Jul 11, 2014 by lemel
Hi,

I would like to be able to read files on the microSD card 2GB with the stm3210E-eval board. I implemented the diskio.c functions for FatFs in read only.

When I call the f_open() function I always got an FR_NO_FILE error even if the file exists. And when I call f_readdir() the fno.fname[0] is always equal to 0.

Do you have any idea why?

Here comes the code when I call the functions.

err = f_mount(&FatFs, "", 0);
 
if(err == FR_OK){
 
/* Open root directory */
   err = f_opendir(&dir, path);
   if(err == FR_OK){
     
     /* Read directory */
    err = f_readdir(&dir, &fno);
     
    if(err == FR_OK && fno.fname[0]!=0){
              STM_EVAL_LEDOn(LED1);
       fn = fno.fname;
       }
   }
    
   /* Close directory */
   err = f_closedir(&dir);
    
   if(err == FR_OK){
   }
 
   /* Open a text file */
   err = f_open(&file, "0:/message.txt", FA_READ);
   if(err == FR_OK){       
       STM_EVAL_LEDOn(LED2);
   }else if(err == FR_NO_FILE){
       STM_EVAL_LEDOn(LED3);
   }else{
       STM_EVAL_LEDOn(LED4);
   }
  
  /* Close the file */
 err = f_close(&file);

Outcomes