This is my first time using freertos. I am using a SAM4 chip and trying to configure it so that it can write to an sd card.
I currently have it setup for one task to simply write to the sd. When I read back the file it is all good except for at extremely regular intervals I get a segment of extended ascii garbage inside my file, but mostly I just see the good data. My first instinct was that the tick interrupt was causing an error in my spi communications.
The first thing I tried was a lazy approach that I thought was garaunteed to work. I surrounded each call to a fatfs function with portENTER_CRITICAL and portEXIT_CRITICAL. I realize that is not a good way to do it and it was really just a diagnostic measure. But anyways… No dice, identacle behavior to before.
The next thing I tried was to write one thing and then wait for the next tic in order to write again. I know that the write fits in between ticks. I get the same data corruption in (weirdly) the exact same spot.
I know that this is RTOS related because when I run very similar code without the rtos it writes perfectly.
Any ideas? I don’t even know what to try next. I seem to get corrupt data every 400 characters or so.