-
Hello! I have two executors running, one on core 0 and one on core 1. Timer events work as expected. GPIO events, however, only work, if the task runs on the executor on core 0. Browsing through the implementation in This is how I initialize embassy, the IO pin and the executor on core 1: let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
let button = AnyInput::new(io.pins.gpio4, Pull::None);
let timg1 = TimerGroup::new(peripherals.TIMG1, &clocks);
let timer0: ErasedTimer = timg1.timer0.into();
let timer1: ErasedTimer = timg1.timer1.into();
esp_hal_embassy::init(&clocks, [timer0, timer1]);
let mut cpu_control = CpuControl::new(peripherals.CPU_CTRL);
let stack = mk_static!(cpu_control::Stack<2048>, cpu_control::Stack::new());
let _guard = cpu_control
.start_app_core(stack, move || {
let executor = mk_static!(Executor, Executor::new());
executor.run(|spawner| {
spawner.spawn(app_task(button)).ok();
});
})
.unwrap(); And here's the implementation of #[embassy_executor::task]
async fn app_task(mut button: AnyInput<'static>) {
info!("Starting app_task() on core {}", get_core() as usize);
loop {
button.wait_for_low().await;
info!("Button is pressed.");
button.wait_for_high().await;
info!("Button is released.");
}
} What am I missing? Christian |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Yeah this might be an oversight on our part, GPIO interrupts are only handled by the first core at the moment. The interrupt handler is bound to the first core (more precisely, where you call Io::new()), so the second core doesn't get the requests. |
Beta Was this translation helpful? Give feedback.
-
What the log output of the code you pasted? |
Beta Was this translation helpful? Give feedback.
-
Thank you all for your quick support! |
Beta Was this translation helpful? Give feedback.
I think you can't do that because
gpio_interrupt_handler
is private. MovingIo::new()
to core 1 is probably your best bet right now.