2022-07-05 08:41 AM
Hello,
I have a problem of f_read in the example project FatFS_uSD_Standalone that the function has never been return when trying to read an empty SD cards.
The following Pseudocode can access sd successfully in the example project FatFS_uSD_Standalone:
f_mkfs
f_open(FA_CREATE_ALWAYS | FA_WRITE)
f_write
f_close
f_open(FA_READ)
f_read
f_close
Need to check the SD card first to see if it is empty or not:
f_open(FA_READ)
if(ok)
{
f_read
f_close
}
else
{
f_open(FA_CREATE_ALWAYS | FA_WRITE)
f_write
f_close
}
- f_open(FA_READ) never return if no file exist.
I appreciated that if you provide any suggestion regarding this issue.
Thanks,
2022-07-05 09:37 AM
Assume you'll need to instrument and debug your implementation.
Make sure stack and heap are adequate.
Media Empty or No Media in Socket?
Media Empty or Doesn't have one specific file you're looking for?
Is the media formatted?
What error/status is returned in the NOT(ok) path?
What board/STM32 are we talking about here.
2022-07-05 10:40 AM
"the function has never been return when trying to read an empty SD cards."
How, exactly, do you determine that?
Have you tried using the debugger to step through the code, and see where it gets stuck?
(including pseudo code)