Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


NVIC priority and FreeRTOS priority?

Posted by Thomas Johansen on November 21, 2012
Hi all

Hope someone can make me understand NVIC priority and FreeRTOS priority on Cortex M3 CPU's? (If that is possible :-))

From the FreeRTOS website:

"Therefore, any interrupt service routine that uses an RTOS API function must have its priority manually set to a value that is numerically equal to or greater than the configMAX_SYSCALL_INTERRUPT_PRIORITY setting."

My configMAX_SYSCALL_INTERRUPT_PRIORITY is defined to 40 ( 5 << (8 - configPRIO_BITS) )
I'm using CMSIS libary function NVIC_SetPriority(..) to set the NVIC priorities for interrupts.
The NVIC_SetPriority function does the shifting.

So which number must be greater or equal to configMAX_SYSCALL_INTERRUPT_PRIORITY
The value used in the NVIC_SetPriority function or the resulting priority???

I do have some ISR's calling xxxxGiveFromISR API function. So the NVIC priority set for those ISR'r must be set to more then 40?

As I understand a higher prio number on a Cortex M3 is equal to lower prioriy and in FreeRTOS it is higher?


RE: NVIC priority and FreeRTOS priority?

Posted by Dave on November 21, 2012
Here is an example I just lifted from the new Atmel demo (I didn't choose the macro names!)

/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
PRIORITY THAN THIS! (higher priorities are lower numeric values. */

This defines configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY to be in a form acceptable to the NVIC_SetPriority function.

/* Interrupt priorities used by the kernel port layer itself.  These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */

This uses the configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY definition to set configMAX_SYSCALL_INTERRUPT_PRIORITY in a form acceptable to the NVIC directly (which is how the FreeRTOS port layer uses it internally).

In this example, an interrupt that uses the FreeRTOS API has to have its priority set using the NVIC_SetPriority() function to a value of 10 or higher (so 10, 11, 12, etc).

(I also didn't design the Cortex-M3 NVIC mash up!)

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists