-
Notifications
You must be signed in to change notification settings - Fork 12
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
riot-rs-threads: WFI not working as expected on riscv/ esp #310
Comments
Fixes future-proof-iot#310 for the system timer interrupt here.
This is actually not correct. I ran into the same issue for the nrf52840dk when using the // Will run in a thread when the `executor-thread` feature is enabled
#[riot_rs::task(autostart)]
async fn task() {
riot_rs::debug::println!("[task] Hello");
embassy_time::Timer::after(embassy_time::Duration::from_secs(5)).await;
riot_rs::debug::println!("[task] Hello again");
} The execution stalls after the timer. Interestingly, the issue here is different than for esp. For esp, I noticed the issue when testing the esp-wifi thread (#300), because the systimer didn't trigger. For cortex-m on the other hand, the timer triggers but then the @kaspar030 any idea what the issue for cortex-m could be? I will do further debugging, but maybe you already know what the problem is? |
I can reproduce this on nrf52840dk. Just adding a |
ah, re-read and saw this now. The interrupt that does the "wfi" dance needs to be preemptible, so probably set to the lowest priority possible. (does that even work on risc-v?) |
Yes, I have set the I'd close this issue as soon as #312 is merged, and reopen/ reiterate if we run into an scenario where we wait for an (embassy?) interrupt that doesn't have a high enough prio. |
Fixes future-proof-iot#310 for the system timer interrupt here.
Fixes future-proof-iot#310 for the system timer interrupt here.
While testing #304 I noticed that the WFI (wait for interrupt) in
riot_rs_threads::arch::riscv::sched
(when the runqueue is empty) doesn't work as expected, at least not when using it together with embassy timers.The expected behavior would be that when the scheduler
wfi
, an embassy timer that expires would cause an interrupt and the scheduler would wake up again.It works for the
cortex_m
impl as expected, so it's most likely that:a) we are using the WFI mechanism for riscv wrong and/or a missing something or
b) there is some issue related to the embassy timer implementation for esp
I'll look into it.
The text was updated successfully, but these errors were encountered: