2021-06-01 05:38 PM
I hope this is a good place for this.
I had difficulty getting an SD card read to work with FATFs code generated by CUBE. The file at first appeared to get corrupted after about 20K bytes and I spent considerable time trying to figure out what I was doing wrong.
It turned out to be an issue with the function sd_read_block in file sd.c. Specifically there is a call to sd_delay with an argument of 5. This would cause 5 nulls to be sent to the SD card to pump its internal state machine. In my case I needed to change the delay to 10.
Using Windows 10, CUBE version 5.6.1 and Keil 5.34.0.0.
My SD card is embedded in the HW and I am unable to get to it so I can't report the brand but it is a 4GB card.
I hope this helps someone else.
2021-06-01 07:17 PM
Thanks @mycall for the initiative to potentially help other developers to save form potential trouble :thumbs_up:
2021-06-07 08:11 AM
Hi @mycall ,
Thanks for reporting this issue.
In order to confirm it and fix it for all other users who may face such a problem, could you please;
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.