Interrupt and Task Synchronization Issue when using Semaphore.
I have one ISR and one FreeRTOS Task.
The ISR copies the data into queue whenever the ISR occurs. and
FreeRTOS Task copies the data whenever there are some data in the queue.
It is synchronsied using Semahpores.
If the interrupt calls evvery 100/10 ms, everything fine.
if the interrupt calls every 1ms/100m micro seconds, the FreeRTOS task is not
reading anything from the FIFO and the buffer overflows at the ISR Side.
Since, the ISR takes the Semaphore always, it seems that the FreeRTOS
is not copying the data and in the blocked or suspended mode.
Any idea how to handle this scenario?
any other way other than Semaphore?
Semaphore takefrom ISR();
// Copies data into static queue
Semaphore givefrom ISR();
// Receives data from the static queue
You should try to reduce the interrupt rate (e.g. add an ISR private buffer to collect some more date before putting it into the shared, sem.protected Q).
I guess your system is just overloaded when using the higher interrupt rate ie. is busy with ISR processing and there is no chance for the task to get into running state.