stm32: fix low-power regressions after executor/low_power split#5713
stm32: fix low-power regressions after executor/low_power split#5713fe1es wants to merge 1 commit intoembassy-rs:mainfrom
Conversation
|
The critical section is needed to prevent interrupt handlers from running with the time driver stopped:
With the critical section:
Running We should try to figure out why the hardfaults are happening and fix those. I don't think "use a CS to sleep" is inherently wrong, the cause must be something else. |
|
I agree that the critical section is needed as I found that the HardFault seems to depend on debug-in-sleep/stop state rather than the critical section itself:
This looks similar to the STM32 WFI / debug-sleep issue described here: https://cliffle.com/blog/stm32-wfi-bug/. As suggested in that post, I tried inserting |
|
bender run |
|
there's registers that can be checked that should give info on why the hardfault is happening. Maybe that gives clues https://interrupt.memfault.com/blog/cortex-m-hardfault-debug
I don't think it's this, that only happens in super old stm32's |
|
I followed the Memfault HardFault-debug approach by capturing the stacked fault frame and disassembling around the captured Setup:
In a follow-up build, I inserted a The fault does not seem to be specific to the original post- I also tried an EXTI wake test, and that path worked without HardFault. I found a similar STM32U5 errata Related links:
It looks like the issues other than the HardFault were fixed by #5753. Since I don’t have a safe fix to propose for the HardFault itself, I’d like to close this PR for now. |
Is this your analysis or are you simply repeating what I said? The stm32wb behavior is still different to what it was before, but I haven't had time to fully examine this. |
|
The other thing you could try is to recover from the hardfault and continue program execution at 0x080004a6. If this approach works, we could document this solution as a workaround to this issue. |
I was referring to the other two issues I tried to fix with this PR. I tested with commit cf6a6cd on
I could try it as an experiment, but I don’t think “recover from HardFault and continue” sounds like a general workaround. Instead, I’d suggest using something like |
This fixes STM32 low-power regressions introduced by #5671.
Before this patch, low-power sleep/wake could HardFault or fail to awake from deep sleep.
This restores the previous STM32 low-power behavior by:
critical_sectionfrom the STM32 sleep path, which fixes the HardFault around low-power sleep/wakeon_wakeup_irq_or_event(), which fixes failure to awake from deep sleeppause_time()orplatform::enter_stop()fails, which avoids continuing into an invalid low-power path after setup failureTested on:
stm32u073cctime-driver-any(TIM15)executor-thread