Quality RTOS & Embedded Software

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


FreeRTOS context switch problem

Posted by jvgediya on September 27, 2017

I am using FreeRTOS for my high traffic network application on CM4 without FPU. I am using CM3 port because there is no FPU on CM4.

I have configASSERT defined in FreeRTOS. My controller supports 3 Priority bits and I have defined below priority related macros which should be proper.

~~~ /* Cortex-M specific definitions. */

/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS               __NVIC_PRIO_BITS
#define configPRIO_BITS               4        /* 15 priority levels */

/* The lowest interrupt priority that can be used in a call to a "set priority" function. */


/* 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 INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values. */


/* 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. */


/* !!!! configMAXSYSCALLINTERRUPT_PRIORITY must not be set to zero !!!! See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */


/* Normal assert() semantics without relying on the provision of an assert.h header file. */

define configASSERT(x) if((x) == 0) {taskDISABLE_INTERRUPTS(); for(;;);}


NVICPRIOBITS is defined as 3. I am setting priority of my interrupt as 3 which is higher(logically lower) than configLIBRARYMAXSYSCALLINTERRUPTPRIORITY so it should be fine too for using FreeRTOS(ISR) APIs from ISR.

I am using FreeRTOS V9.0.0.

Problem statement: I am using FreeRTOS queues for commmunication between ISR and Tasks. When i use portYIELDFROMISR() inside ISR, Even if item is posted successfully to the Queue, Task which is blocking on QueueReceive is not getting unblocked. Everything works for sometime but suddenly this issue appears.

I tried stack overflow hooks but it is not hitting and i have provided enough stack for tasks and interrupts.

This issue appears only when i do YIELD from ISR otherwise everything works fine.

Anyone have any idea about the possible issue?

FreeRTOS context switch problem

Posted by rtel on September 27, 2017

Can you post the code that sets the priority of the interrupt, and the ISR code, thanks.

Which version of FreeRTOS are you using?

FreeRTOS context switch problem

Posted by jvgediya on September 28, 2017

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

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

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

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

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

Cadence Tensilica Cortes

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