Quality RTOS & Embedded Software

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




Loading

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

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

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

define configLIBRARYLOWESTINTERRUPT_PRIORITY 0x7

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

define configLIBRARYMAXSYSCALLINTERRUPTPRIORITY 1

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

define configKERNELINTERRUPTPRIORITY (configLIBRARYLOWESTINTERRUPTPRIORITY << (8 - configPRIOBITS))

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

define configMAXSYSCALLINTERRUPTPRIORITY (configLIBRARYMAXSYSCALLINTERRUPTPRIORITY << (8 - configPRIOBITS))

/* 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 ]    [ Sitemap ]    [ ]




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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