cancel
Showing results for 
Search instead for 
Did you mean: 

Got FR_INT_ERR when running f_read() in Project FatFS_uSD_Standalone

AFung.1
Associate II

Hello,

I am using NUCLEO-H743ZI2 and running the project FatFS_uSD_Standalone with AdaFruit microSD. The TFT_ShieldDetect() is commented out because there is no LCD. The STM32.txt is successfully created and the text is successfully written into the file and read back.

I would like to read the existing text file STM32.txt. I modified the code for this purpose:

  • f_mkfs() is commented out since I don't want the contain to be erased. Then run the following code:

 if(f_mount(&SDFatFs, (TCHAR const*)SDPath, 0) == FR_OK)

 {

HAL_Delay(1);

res = f_open(&MyFile, "STM32.TXT", FA_OPEN_EXISTING | FA_READ);

   if(res == FR_OK)

   {

   res = f_read(&MyFile, rtext, sizeof(rtext), (void *)&bytesread);

   f_close(&MyFile);

  }

}

The error FR_INT_ERR  is returned from f_read(). How can I read the content of an existing file?

Thanks,

4 REPLIES 4

Internal errors, could be memory corruption/caching. Adequate stack space for local/auto variables.

For large MicroSD cards, could be an old version of FatFs library

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
AFung.1
Associate II

The size of the microSD is 64Mb. The buffer size of rtext is 100 bytes.

AFung.1
Associate II

Hello Tesla,

But the original project is working with write and read. How can I read the existing file only?

Thank,

Andy

The size of the microSD is 64Mb. The buffer size of rtext is 100 bytes. The file can be successfully opened but return FR_INT_ERR from f_read(). Not sure what causing it. Can you give some advice on this?

Thanks,