Quality RTOS & Embedded Software

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


Global interrupt disable/enable

Posted by Nobody/Anonymous on February 10, 2006

I'm trying to write a program for a MSP430 and in my design it is important that one TimerB interrupt is not allowed to disable because it is very time critical and this interrupt can appear in some 10-20┬Ás.
In the freeRTOS I found that global interrupt disable is used (portDISABLE_INTERRUPTS()).
Is there something to keep in mind to change this that all interrupt except the Timer B interrupt?
This interrupt routine will save all changed registers.
Is freeRTOS still executable when one interrupt can appear all the time?


RE: Global interrupt disable/enable

Posted by Richard on February 10, 2006
It is inevitable that an OS will from time to time require interrupts to be disabled. This is to ensure consistency of its (ie the schedulers) and tasks structures. FreeRTOS uses a scheduler locking mechanism to allow interrupts to remain enabled for the majority of time while the scheduler data structures are updated - keeping the time interrupts are disabled to a minimum.

10us seems very fast so you may have problems with interrupts being missed even if they are held pending while interrupts are temporarily disabled. You would need to try this on your particular application to know if this was a problem or not.

Allowing interrupts to be nested would help. If you never context switch from within an interrupt this is easy - if you do context switch from within an interrupt then you have to count the interrupt nesting depth and only perform the switch when it was back to zero.


RE: Global interrupt disable/enable

Posted by Nobody/Anonymous on February 10, 2006
Thanks for that information.
When I looked at a scope I can see that sometimes the Timer B output is not correct meaning the interrupt reloading the compare register has not taken place. Since Timer B interrupt has highest priority (except NMI and reset) it can only happen when the GIE is cleared to long preventing the interrupt to take place.
Since the reloading of just the compare register ist a very small routine, I thought to leave this INT enabled all the time. And changing the the
portDISABLE_INTERRUPTS() macro. But I'm not sure if there is any scenario which makes freeRTOS sheduling corrupt.

RE: Global interrupt disable/enable

Posted by Nobody/Anonymous on February 10, 2006
Provided the interrupt that reloads the timer does not cause a context switch then leaving it enabled should be ok.

Also check the portENTER_CRITICAL macro implementation which may just call portDISABLE_INTERRUPTS or may have a different implementation depending on the port you are using.

RE: Global interrupt disable/enable

Posted by Nobody/Anonymous on February 10, 2006
I will try out and thanks for that really fast answer!!

[ 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