I encountered an issue where a periodic task (using vTaskDelay) doesn't run when other non periodic tasks are very active. This makes sense for non-periodic tasks with the same or higher priority than the periodic tasks, but I found that a busy lower priority task (task blocks/reads from queue) also causes a "lockout" of the periodic task. In this case, I would assume that once the timer for the periodic task expires, the scheduler will always switch to the higher priority periodic task at least by the next sys tick (depending whether pre-emption is enabled, which it is). Generally speaking, this should be correct, right?
What could cause a periodic task to be "locked out" when lower priority non-periodic tasks are busy and can run continuously?
is the low priority task keeping interrupts disabled for long periods?
No, but there is a UART ISR that puts data into a queue. The low-priority task reads/blocks on this queue. The issue I'm seeing occurs when there's a lot of communication going on. Neither the ISR nor the low-priority task disables interrupts purposefully (except inside the freeRTOS APIs that are called)
How are you using the queue in the interrupt? Lots of our demos place
every received character into a queue - which is fine for testing the
kernel (which is why we do it) and convenient for low bandwidth
interfaces such as telnet key handling, but otherwise very inefficient.
Ideally use a DMA, or at least a FIFO, and place received characters
in a RAM circular buffer. Then, when a message is complete, or a break
in communication is detected, use a direct to task notification to
unblock a task. That will be much more efficient.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.