-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OOB-5.14][DISCO_L475VG_IOT01A] defining MBED_SLEEP_TRACING_ENABLED with LPTICKER fails in mutex ISR error. #11497
Comments
There are similar reports #10051 cc @ARMmbed/team-st-mcd |
There is a mention of stack overflow issues in https://os.mbed.com/docs/mbed-os/development/tutorials/power-optimization.html I'm observing |
Could you still increase the stack size here and see if that can help ? Stack overflow seems to possibly have side-effects of mutex/ISR issues ... |
No idea if this type of error still occurs in this version but maybe this is related: #10481 |
Internal Jira reference: https://jira.arm.com/browse/MBOCUSTRIA-1768 |
Hi @LMESTM, I did try the mentioned value of |
As a side note, I just tried and it seems to reproduce in |
My current mbed_app.json configuration
This fails on both |
Ok I could reproduce it. The backtrace shows that it is caused by mbed_error_printf being called from interrupt context in the functions related to sleep tracing (MBED_SLEEP_TRACING_ENABLED)
That is somehow surprising as the history of mbed_power_mgmt.c shows that mbed_error_printf is supposed to be ISR friendly ...
so I'm not sure what to look at next ... |
It should be:
this puts function has
@kjbracey-arm Can you review ? |
A dummy print at the top of |
That note actually describes the behaviour, but the word "crash" is missing.
|
I recall this was discussed previously and we haven't found a better way than this. Is this documented? If not we should have. A user should be able to find this once this error is hit in their app. Looking at https://os.mbed.com/docs/mbed-os/development/tutorials/power-optimization.html , there is no note about console relation , shall we add it to the troubleshooting ? For a user to find it as they will search for it once they hit the error ("sleep logging mutex error"). |
We quickly tried to add a dummy print to the main, but unfortunately without much luck. |
It's documented in |
Adding the dummy print to the beginning and using unbuffered serial causes a reset loop like originally repoted. If this is interrupted, the backtrace looks as following:
|
Am I reading that correctly that there is This would make sense in a way that I'm unable to break at |
One thought - And yes, it looks like it's calling a Clearly we haven't quite started yet (we're in |
You could try forcing a pre-main console initialisation with
|
Switched my main.cpp to following:
Unfortunately it still ended up in a reboot loop. |
Recording it here too: |
Using |
The reason is that LP TICKER dirver for STM32 makes use of deep sleep lock (which BTW I think should be done as well by Serial drivers for instance to make sure we don't enter deep sleep before the transmit buffer is fully empty ...). Anyway the lock is being taken before the stdout is available. I think @kjbracey-arm pointed a possible forward:
|
Based on above I tried |
By doing this you actually fully prevent use of deep sleep because us_ticker (comparted to lp_ticker) does not allow deep_sleep ... so you're tracing sleep but will always get 0% deep_sleep ;-) I'd rather think of asking @kjbracey-arm to propose a change to singleton_lock ... |
That is true, I just wanted to try it with the USTICKER if it removes the error. |
One suggestion - change |
I tried above, it does remove the crash, but it 99% disables deep sleep too. Maybe this is expected with the deep sleep lock tracing? I'm not sure. The Diff for above modification:
The interesting part though is that, with this enabled, it seems to do different things in Without deep sleep lock tracing, the both application trace following:
If the deep sleep lock tracing is enabled with
and it never seems to end. NUCLEO_F411RE:
The Deep Sleep counter does increase very slowly. |
I think that tracing each and every lock / unlock may not always make sense.
|
@kjbracey-arm Is it on going ? |
Tried this suggestion of @kjbracey-arm on target DISCO_L072CZ_LRWAN1 with toolchain GCC_ARM
and the application is not functional. |
@pdemil the suggestion above is needed, but is not enough. |
hundreds every second? Wow, I agree it is not worth tracing all those lock/unlocks. I think @korjaa wants deep sleep for a long time (>5 minutes) and no wake-ups every second, so maybe an RTC based wake-up (or 32 bit LP timer) is needed? |
@pdemil Yes it could make sense, but still when your application is active, you would probably get the many lock / unlock iterations. EDIT : actually using a debugger you can get access to the table of the various lock / unlocker user. It is much more efficient than tracing to access the table at any point in time when setting a breakpoint in your application and see who is holding a lock For avoiding wake-ups every seconds, you'll need to add application specific code as of now - refer to discussion in #10211 |
@LMESTM Just checking whether this issue is still valid. |
@LMESTM just a reminder on this issue - seems it's still valid. |
I'm having similar issues trying to trace sleep locks while developing on my NUCLEO-H743ZI2 board. In short, to get the sleep tracing to not crash, I need to:
|
@MarceloSalazar @faydr I've suggested a few way forward and solutions don't seem to be STM32 related:
|
Description
Target:
DISCO_L475VG_IOT01A
Toolchain:
GCC_ARM 6.3.1 20170620 (release)
mbed-cli:
1.10.0
mbed-os:
f60e9a8075 (HEAD, tag: mbed-os-5.14.0-rc2, origin/mbed-os-5.14) Merge pull request #11476 from ARMmbed/release-candidate
Steps to reproduce:
mbed new
MBED_SLEEP_TRACING_ENABLED
to mbed_app.json macros.mbed compile --target DISCO_L475VG_IOT01A --toolchain GCC_ARM --clean
Log output:
Below message is printed in a loop.
The message it self says the system will be halted, but that doesn't seem to happen.
Issue request type
The text was updated successfully, but these errors were encountered: