cancel
Showing results for 
Search instead for 
Did you mean: 

Cant disable all interrupt while using CMSIS RTOS V2

HZaib.1
Associate III

Hi everyone I am using stm32l496 and I am trying to disable all the interrupts while running sensative routines.

to disable all the interrupt I am using __disable_irq and to enable them  __enable_irq.

But nothing seems to happen, even after I use disable in one of the task the interrupts still functions.

Now I checked what __disable_irq is actually doiung and in the comments it is written that it can only be excecuted in Privileged mode, now I have no idea what this mode is even or how can I switch to it.

1 REPLY 1
KnarfB
Principal III

After reset, the MCU is in priviledged mode, but the RTOS will run the threads in user (unpriviledged) mode. The RTOS scheduler depends on an interrupts and disabling all interrupts would affect the scheduler. Here is some reading on that: https://interrupt.memfault.com/blog/cortex-m-rtos-context-switching

So, this is by design. Look for a less intrusive method to accomplish the desired behaviour, like thread priorities or synchronisation methods.

hth

KnarfB