Description
I found a problem with the embassy-executor and the low-power feature in embassy-stm32. In my example the executor sets an alarm for Instant::MAX when I spawn my (only) task.
embassy/embassy-executor/src/raw/mod.rs
Line 421 in 4306968
The question now is what is the best way to fix this. You could fix this by only calling set_alarm in the executor when the timestamp is not Instant::MAX. There might also be some other fix in the executor. But in any case I don't want to make any changes there since I don't know all requirements and don't want to break anything.
The other way to fix this would be to have the time driver discard any set_alarm calls which pass Instant::MAX as a timestamp.
In any case it would be good if someone more experienced in the executor and the time driver of stm32 could have a look into this.
I uploaded a fix to my embassy fork (chrenderle@7d6b7ea). It is only a demonstration how you could fix it in the executor. I tested it on my NUCLEO-L552ZE-Q. But this does currently not compile with STM32L5, because embassy-rs/stm32-data#325 is not yet merged. I worked around this by building stm32-metapac locally.
My fork also includes another minor change (chrenderle@96edbcc). Without it the low-power executor does not always suspend execution properly. This is later necessary for STOP suspension. Without this change the error I'm describing is also not active, since the low-power executor doesn't suspend properly.