I’m using FreeRTOS 8.0.1 on an ARM Cortrex M4F (NRF52832) I have the following issue: There is a writing task SM (priority 2, sorry for the name, it actually means ‘System Manager’ 🙂 ) and a reading task NI (priority 1). The reading task sometimes needs to read a lot of data from our storage. However, it does this in bursts, taking a mutex, reading a block, and releasing the mutex again.
The writing task should have precidence over the reading task. However this does not seem to happen. The reading task does not seem to want to yield to the writing task. At some point the writing task will not be able to get the mutex within a reasonable limit. In that case the writing tasks writes an error message and does a busy waiting loop.
There are no mutex besides the read and write mutex (and the SPI mutex below). But all should be released once the task have completed the read and/or write operation. I’ve looked through the code and every branch is covered.
Two observations, see SystemView screenshot. First the SM task indicates it wants to run (-300 us), but does not seem to get to run! second the NI wants to run, and does get to run. Why? MS task has higher priority and should run first.
Second, even though the SM task has a higher priority, the NI task still gets time from FreeRTOS.
Any insights welcome.