I’m having an issue with the CPU did not sleep in time.
I have a task that calls ulTaskGenericNotifyTake function to delay for 5 milliseconds. At this time, the TCB is added to pxDelayedTaskList. After 2 milliseconds, an interrupt is received to call vTaskGenericNotifyGiveFromISR function to wake up the task. Then, the task is added to xSuspendedTaskList through ulTaskGenericNotifyTake function. At this time, the program is expected to enter sleep in prvIdleTask, but because xNextTaskUnblockTime is not reset, the program does not enter sleep immediately, but after 3ms.
Can I call prvResetNextTaskUnblockTime in vTaskGenericNotifyGiveFromISR function to solve this problem?
After receiving the UART interrupt, it is expected that the task execution can be suspended as soon as possible, and then the CPU can enter sleep. When I tested the power consumption, I found that the CPU could not enter sleep in time because the xNextTaskUnblockTime value was not reset after the task was woken up in vTaskNotifyGiveFromISR.
Hi, aggarg
Thank you for your method!
What I provided is just a simple example. I know your code can solve the problem, but my question is whether it is necessary to call prvResetNextTaskUnblockTime in the vTaskGenericNotifyGiveFromISR function.