Global interrupt disable/enable

Hi, 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? Thanks

Global interrupt disable/enable

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

Global interrupt disable/enable

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.

Global interrupt disable/enable

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.

Global interrupt disable/enable

I will try out and thanks for that really fast answer!!