Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 2 months ago.
mbedOS error (Mutex: 0x2000477C, Not allowed in ISR context)
Target system=NUCLEO_L476RG
I have a project that works fine with older mbedOS5 .. Using the latest firmware cause the mbed to fail to start. The strange thing is compiling the code using online IDE gives a binary file that the error is not the same as if I locally compile the same code with eclipse. The binary from online compiler gives this error:
-- MbedOS Error Info -- = System will be rebooted due to a fatal error = = Reboot count(=5) reached maximum, system will halt after rebooting ++ MbedOS Fault Handler ++ FaultType: HardFault Context: R0 : 00000004 R1 : 0000000D R2 : 08000000 R3 : 00000004 R4 : 20000C6A R5 : 08038984 R6 : 00000000 R7 : 00000000 R8 : 00000000 R9 : 00000000 R10 : 00000000 R11 : 00000000 R12 : 00000001 SP : 200025C0 LR : 0800A319 PC : 0800A328 xPSR : 01000000 PSP : 20002558 MSP : 20017FC0 CPUID: 410FC241 HFSR : 40000000 MMFSR: 00000082 BFSR : 00000000 UFSR : 00000000 DFSR : 00000008 AFSR : 00000000 MMFAR: 00000004 Mode : Thread Priv : Privileged Stack: PSP -- MbedOS Fault Handler --
Now, using eclipse and ARM GNU compiler the fault report is as bellow:
-- MbedOS Error Info -- = System will be rebooted due to a fatal error = = Reboot count(=1) reached maximum, system will halt after rebooting ++ MbedOS Error Info ++ Error Status: 0x80010133 Code: 307 Module: 1 Error Message: Mutex: 0x2000477C, Not allowed in ISR context Location: 0x800852F Error Value: 0x2000477C Current Thread: main Id: 0x20001338 Entry: 0x800845F StackSize: 0x1000 StackMem: 0x20003748 SP: 0x100004E0 For more info, visit: https://mbed.com/s/error?error=0x80010133&tgt=NUCLEO_L476RG
Knowing that my code just works fine with older mbedos.
I have thread, SDBlockdevice and serial interrupt. I used even RawSerial without any success.
I don't know what causes the Mutex error. Why different problems and what is the problem? Thanks.
2 Answers
5 years, 2 months ago.
Hi Mariwan,
We add flag "-DMBED_TRAP_ERRORS_ENABLED=1" to develop profile as well in Mbed OS 5.13, so if you use functions not allowed in ISR, you will have this failure.
Please check the functions in ISR or use release profile but this is not recommended because there might be some potential issues.
Regards, Desmond
5 years, 2 months ago.
Hi there,
The mutex error is probably caused by the serial interupt. Just comment the serial interupt or change it to polling method and you will see.
Edit:
- What was the latest functional version for you?
Best regards J.
Here is what I find in mbed.h
#if MBED_CONF_RTOS_PRESENT // RTOS present, this is valid only for mbed OS 5 #define MBED_MAJOR_VERSION 5 #define MBED_MINOR_VERSION 8 #define MBED_PATCH_VERSION 6 #else // mbed 2 #define MBED_MAJOR_VERSION 2 #define MBED_MINOR_VERSION 0 #define MBED_PATCH_VERSION MBED_LIBRARY_VERSION #endif
I even removed the interrupt from the code ..but still it crashes. Note: I have 2 threads. First thread run the normal code, second thread will wait for the interrupt to change a value.. That is all what the interrupt do. As I said, I even disabled the interrupt but still the problem occurred I wounder it if the problem is not in the SDBlockDevice?
In the local version, I have the old SDBlockDevice library.
posted by 27 Aug 2019So if I understand correctly your last working version of MbedOS is 5.8.6 and all newer ones don't work, correct? You can check or change that when you click on Mbed lib in the tree of the online compiler and hit the revision button.
My point is about a change in version 5.10 if I remmember correctly. From this version the serial.attach(...), can.attach(...) methods not working, probably for some or all ST boards.
However, you need to find a part of code where you call a method of some class in interupt context and where is the mutex called. Without see the code or its a simplest version no one can help you I think.
J.
posted by 27 Aug 2019
Here is some more details about the problem.. This is from gdb call stacks. :
It is clear that the problem happens with the default console.
And I enabled some more info about the problem :
I think the problem is with the default console .. It fails to get it working for some reason.
posted by M J. 28 Aug 2019