Hello, I am working on a project where data shall be logged onto a SD Card.
I am using a stm32 mcu with freeRTOS running on it. I use spi and the fatfs library to communicate with the sd card.
I have a own task which write the data from a circular buffer to the sd card with spi1. No other task is accessing spi1 or is doing any stuff with the sd card. The data logging works fine until some point in time, the data on the sd card gets corrupted with unreadable stuff.
see following example of sd card data:
1;3;31986;5;10;56;59;50;12204;12160;-26;1;7800;527728;-527292;9;10;9;0;150391; (good data)
õÓÃuŒÂÕq Ùý+ñaÙï+±è[Ž&Û)% !É;IdH¦L*W (bad data)
1;3;26447;5;10;56;59;50;12216;12160;-26;1;7800;381132;-380813;9;10;10;0;150391; (good data)
It recovers itselfe and write correct data again. The other tasks keep running at the same time, because the functionality of the other tasks is still working. also the log data says that the internal time has increased at the time during the faulty write occured.
I tryed to figure out if any other task is disturbing during the write to the sd card, so I used taskEnterCritical() and taskExitCritical() when writing to the sd card. That did not help.
Also I checked the the circular buffer data was not the cause. This is also not the root of the problem.
Any ideas what could be wrong here.
Sometimes the error doesnt occure for days, then it occures again after 10 minutes. Sometimes is lasts over 1 hour, and writes tons of garbage data. Sometimes it lasts just for a few seconds.
Any help is appreciated.