This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDCard busy after several writes

Hi,

I've modified the SDCard example to write every 2 seconds 80 bytes to a SD Card. The SDCard is correctly mounted and the File is opened and kept open.

After several writes the program hangs being busy

And then the timer expires and the program crashes. I've tested with several SD Cards big and small and it did not change something. Furthermore, I've tested with several SDCARD Frequencies but same here. Is there any reason why the program hangs?

Parents Reply
  • Okay there several strange and undocumented things happening which you should take into your documentatio:

    1. If the Buffer you write is not a power of 2 it fails after the reaching the sector size.

    2. If the half of the sector size is reached the fatfs needs to be synced otherwise it stays busy.

    3. The f_sync call has to be in the main function in the while loop, while the write can be in a timer routine.

    Now I can write very fast about 256 bytes in chunks. But however if I reach 32512 it freezes again and the debugger says:

    That move window is called which means the sector window is moved. And therefore it needs to read from the disk and this does not return. Any idea why this happened?

    Best regards,

    Constantin

Children
Related