Quality RTOS & Embedded Software

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


portENTER_CRITICAL() with-in and ISR in AVR32

Posted by Alexis on March 25, 2013
I have read in multiple area that FreeRTOS calls with "FromISR" should be called with-in an ISR. I have also seen threads where users are specifically told not to use "portENTER_CRITICAL" with-in and ISR, these threads always refer to the ARM Cortex port.

I have been surrounding all my calls with-in ISR as follows:

xSemaphoreGiveFromISR( m_TransmitMobSemaphore, &xHigherPriorityTaskWoken );

Now i am having an intermitted problem and trying to track it down. Not sure if Stack, or interrupts at the moment. But re-reading the manual and the forums i have found that i may well have made a mistake by using "portENTER_CRITICAL();" with-in interrupts.

Now the question is:
vTick() in port.c which is provided with the AVR32 port FreeRTOS V7.0.0 does the following

/* Because FreeRTOS is not supposed to run with nested interrupts, put all OS
calls in a critical section . */

Is that a mistake? is this a special case? Should i leave all my portENTER_CRITICAL(); in my ISR's?


RE: portENTER_CRITICAL() with-in and ISR in AVR32

Posted by Dave on March 25, 2013
Documentation pages for demos always have an "Interrupt Service Routines" section, and the section on the AVR32 page http://www.freertos.org/portAVR32.html says to place the calls in critical sections.

This is an old and I think obsolete port for old AVR32 chips that behave a bit differently to the new ones. The maintained AVR32 code is in the Atmel Software Framework (found at Atmel.com).

RE: portENTER_CRITICAL() with-in and ISR in AVR32

Posted by Alexis on March 25, 2013
Thanks for the quick reply.
Looking at the linked page it does seem to have some slight differences to what is available in the my port, any idea what release that page refers to?

I will keep the critical sections in the code as advised by the link.

Looking at Atmel, they have both 7.0.0 (currently being used) and 7.3.0 in the latest ASF release.I would be weary of moving to 7.3.0 as it would require more validation, will look for a release history so i can see what was fixed.

RE: portENTER_CRITICAL() with-in and ISR in AVR32

Posted by Richard on March 25, 2013
The changes to the FreeRTOS core files can be found here: http://www.FreeRTOS.org/History.txt. You would have to look at any history information provided by Atmel to see any changes made to the port layer they maintain.


[ 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.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

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