Mutex error on enabling the interrupt

Hello everyone,

I am getting a mutex run time error.
I am using mbed studio (mbed6).
Board is STM32F446RE

Below is my code:

int main() {

    pc.set_baud(115200);                   //1            
    printf("...1\n");                             //2
    wait_us(400000);                        //3

Init_HW(&gpio);                            //4

wait_us(100);                            //5


Line 4 calls setup some GPIO and PWM then following line:


When the Nested Vector Interrupt Enable line is called during running,
I get the following Mutex error:

++ MbedOS Error Info ++
Error Status: 0x80010133 Code: 307 Module: 1
Error Message: Mutex: 0x200006D0, Not allowed in ISR context
Location: 0x80108AD
Error Value: 0x200006D0
Current Thread: main Id: 0x20002DF0 Entry: 0x800D205 StackSize: 0x1000 StackMem: 0x20001140 SP: 0x2001FED4
For more info, visit: mbedos-error
– MbedOS Error Info –

Will be thankful for any input, if you need more information please ask. :slight_smile:


this error is usually rising up when you call any type of read/write method during ISR. Typical example is using printf in interrupt context.

BR, Jan

in stm32f4xx_ll_rcc.h

__STATIC_INLINE uint32_t LL_RCC_LSE_IsReady(void)

Can this READ_BIT cause an issue?
Cause when I was trying to debug the code the Mutex fault occur at this line of code.
But what execution lead it to this line I am not sure?
Is it the NVIC enable function?