I made a STM32F405VGT6 board with SD card interface. The SD code is generated using STM32CUBEMX and FatFs middleware.
The SD file write is not stable, it return error sometimes after calling f_write(). However, if I run the same code in uVision debug mode with SWD/ST-LINK connected, the f_write() became very stable.
What could be the difference between with debug mode and without debug mode that causing f_write unstable ? I guess it may be caused by some hardware timing that is too fast without the debug mode. Where can I add delay in the code that simulate the timing of debug mode ？Thanks.
Solved! Go to Solution.
Writing to the SD card is associated with a large consumption, especially when erasing blocks. Most of the problems are associated with insufficient power supply of the card and insufficient blocking of the supply voltage. The problem may not manifest itself in debug mode, because the writes are slower and the capacitors in the power supply are enough to cover them.
Thanks for your prompt reply. Could you explain more about "insufficient blocking of the supply voltage" ？ How can I increase blocking of the supply vpltage ? I can not catch the meaning of "blocking" for supply voltage. Thanks.