How to use Rotary-Encoder using MBED OS6.16 in Keil Studio

I wanna use rotary encoder using mbed os 6.16 in Keil Studio but I can’t do that.
I tried to use Ticker to get data from a rotary encoder. However, I always get the following error message.

++ MbedOS Error Info ++
Error Status: 0x80010133 Code: 307 Module: 1
Error Message: Mutex: 0x20001700, Not allowed in ISR context
Location: 0x8007D5D
Error Value: 0x20001700
Current Thread: main Id: 0x20001B9C Entry: 0x80052D9 StackSize: 0x1000 StackMem: 0x20000518 SP: 0x20017F1C
For more info, visit: mbedos-error
– MbedOS Error Info –

What is your solution to this?

The devices used are listed below.

Mbed OS 6.16 in Keil Studio
NUCLEO-F401RE(This board has been upgraded)


this error is in the context of RTOS and its Mutex who covers all data manipulation. So you can not read your data directly in ISR context with RTOS and you have to move it out of ISR context. This can be done via simple flag or EventQueue.

The mutex is “OFF” with bare metal profile.

BR, Jan

Thank you for replying , Jan !
I used bare metal profile so error message disappeared .
This will advance the research. Thank you.