Skip to content
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

cyw43_pio gpio_set hangs when called from core0_task #3743

Open
JYouren opened this issue Jan 8, 2025 · 0 comments
Open

cyw43_pio gpio_set hangs when called from core0_task #3743

JYouren opened this issue Jan 8, 2025 · 0 comments

Comments

@JYouren
Copy link

JYouren commented Jan 8, 2025

I'm combining the rp2040 w wifi_blinky.rs and multicore.rs examples into a single code file. I can set the wifi driven LED anywhere in my main fn, but when I spawn a new task, the call to control.gpio_set(0, true).await; hangs.

#[embassy_executor::task]
async fn core0_task(
    motion_pin: embassy_rp::peripherals::PIN_28,
    control: &'static mut Control<'static>,
    stack: &'static mut embassy_net::Stack<'static>,
    seed: u64,
    display_led: &'static DisplayMutex,
) -> ! {
    show_screen_text(display_led, "Setting up motion", false).await;
    let mut motion_pin = Input::new(motion_pin, Pull::None); // Read the level of the pin 28
    loop {
        motion_pin.wait_for_falling_edge().await;
        show_screen_text(display_led, "Motion detected", true).await;
        info!("GPIO 28 is low - turning on LED");
        control.gpio_set(0, true).await; // Code hangs here
        info!("making a web request");
        make_request(stack, seed).await;
        info!("turning off LED");
        control.gpio_set(0, false).await;
    }
}

The last entry in the log is:

DEBUG iovar set gpioout = [01, 00, 00, 00, 01, 00, 00, 00]
└─ cyw43::control::{impl#3}::set_iovar_v::{async_fn#0} @ C:\Users\johny.cargo\git\checkouts\embassy-9312dcb0ed774b29\c775604\cyw43\src\control.rs:566

which is the same as when it's called in main, but it doesn't hang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant