Modbus queries are fired repeatedly to devices connected in daisy chain. Randomly( Typically after 2-3 days ) the response is observed to have delayed by 2-4 Seconds.
The processing is as follows.
Bytes are received and pushed to a queue from the uart ISR
The task receives the bytes from the queue and once the packet is received, The response is sent
After days of debugging and monitoring, We found no bug in the code.
Our task priorities are defined as
5 Tasks at Priority=5
1 Task at Priority=6
7 Tasks at Priority=10 ← Modbus hosting task
1 Task at Priority=14
1 Task at Priority=15
We recently made the priorities contiguous keeping the hierarchy same such as
5 Tasks at Priority=1
1 Task at Priority=2
7 Tasks at Priority=3 ← Modbus hosting task
1 Task at Priority=4
1 Task at Priority=5
Doing this change, We did not face the issue but we haven’t been able to justify the gaps in priority as the root cause of the problem.
Looking for opinions/suggestions on the issue and the solution.