Skip to main content
Visitor II
January 5, 2023
Question

Cant disable all interrupt while using CMSIS RTOS V2

  • January 5, 2023
  • 1 reply
  • 1646 views

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.

    This topic has been closed for replies.

    1 reply

    Super User
    January 5, 2023

    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