FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [July 2013 Threads] Higher priority task not switched inPosted by Magnus Kriel on July 15, 2013 I am creating a watchdog (WD) task which monitors all other tasks. If a task does not execute within a set amount of time, the watchdog task will stop kicking the hardware watchdog, forcing a watchdog reset. To test my WD task I have forced one of the tasks to hang by using a while(1). This task' priority is set to 8 and the watchdog task is set to 6. (Cortex M3 device, lower numeric priority number = higher priority). After entering the while(1), no other tasks run, not even the higher priority watchdog task. The systick handler is being executed during this time, but the WD task is not being switched in. I did make sure the WD task is actually created successfully and runs. OS version 7.4.0, Preemption enabled
RE: Higher priority task not switched inPosted by Richard on July 15, 2013 “Cortex M3 device, lower numeric priority number = higher priority” That only refers to interrupt priorities, which are controlled by the hardware, not task priorities, which are controlled by the hardware. A task at priority 8 that is sitting in a null loop without ever entering the Blocked state will prevent a task at priority 6 from ever running, as you have seen. Switch the priorities around and it will be ok. Regards.
RE: Higher priority task not switched inPosted by Magnus Kriel on July 16, 2013 Thank you, I tried swapping the priorities and it worked. This, however generates more questions. I have read through the documentation regarding priorities and and specifically those for the Cortex M3. If I use the settings that comes with the demo project (#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY15 and #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY5), 1) what range can I use for the task priorities? 1 to 15 or 1 to 255? 2) what range of task priorities will be masked out when entering a critical section?
RE: Higher priority task not switched inPosted by Richard on July 16, 2013 “1) what range can I use for the task priorities? 1 to 15 or 1 to 255?” Please do not confuse task priorities and interrupt priorities. Task priorities are under the control of FreeRTOS, are the same for all ports, and are completely unrelated to interrupt priorities (and therefore not restricted in any way to the value of configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY). On all FreeRTOS ports, 0 is the lowest task priority and (configMAX_PRIORITIES -1) is the highest task priority. configMAX_PRIORITIES is set in FreeRTOSConfig.h. “2) what range of task priorities will be masked out when entering a critical section?” No task priorities will be masked out by any critical section....ever. Only interrupt priorities are masked, and in your case interrupts that have been assigned a priority of 5 or lower will be masked. Note that, due to the irrational way Cortex-M handles interrupt priorities, an interrupt assigned a priority of 4 has a higher logical priority than one assigned a priority of 5 (even though it is a lower number) so will not be masked, whereas an interrupt of priority 6 has a logical priority lower than one assigned a priority of 5 (even though it is a higher number) so will be masked. Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|