I have an ARM M3 application using FreeRTOS that is working well. However, I need to modify a piece of code currently receiving events from a background loop to also receive events from an interrupt. It currently inserts data into a queue via xQueueSendToBack. The perceived problem is the interrupt call corrupting a currently executing queue insertion. Can I simply replace with xQueueSendToBackFromISR to protect the queue, or is something more exotic required?
Not sure I fully understand the question, but queues are thread safe objects. You can access a queue from any number of tasks and interrupts simultaneously - on an M3 the only rule is you must use the “FromISR” versions of the API from interrupts.
I think you have answered it. If an ordinary task is somewhere inside the xQueueSendToBackFromISR function inserting its data for a particular queue and an interrupt task takes over the cpu to insert its new data into the same queue, the FromISR function ensures that when both exit the queue correctly reflects the two new data points.
Yes. There are short critical sections in the xQueueSendToBack function to block the ISR for a few cycles when doing parts of the updates to make sure this works.