Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


FreeRTOS sets the systick and pendsv priority to the lowest one

Posted by dijex on November 10, 2015


Debugging some priority issues I saw that the scheduler start sets the systick and pendsv priority to the lowest one.

/* Make PendSV and SysTick the lowest priority interrupts. */ portNVICSYSPRI2REG |= portNVICPENDSVPRI; portNVICSYSPRI2REG |= portNVICSYSTICKPRI;

Could you please explain to me why it is mandatory to set those interrupts to the lowest priority and what is the impact if they are kept in the highest priority.

Thanks a lot for your support.

With regards.

FreeRTOS sets the systick and pendsv priority to the lowest one

Posted by rtel on November 11, 2015

The PendSV interrupt is the only place a context switch occurs. If a context switch is requested from an interrupt, then the PendSV interrupt is pended, and when the interrupt exits, the PendSV interrupt handler executes and performs the context switch. If the PendSV interrupt is not the lowest priority interrupt then the PendSV handler might execute as soon as it is pended, and so nest with the original interrupt. Also, consider that interrupts can nest, and if there is more than one nested interrupt that requests a context switch then you only want the PendSV handler to execute once, and only when the nested interrupts have all completed.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner