2022-06-20 03:53 PM
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:
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,
2022-06-20 06:06 PM
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
2022-06-20 06:35 PM
The size of the microSD is 64Mb. The buffer size of rtext is 100 bytes.
2022-06-21 08:58 AM
Hello Tesla,
But the original project is working with write and read. How can I read the existing file only?
Thank,
Andy
2022-06-21 01:26 PM
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,