From 9f45e3c90512cf2feed7c5bab7bb3b4bac5a4bf6 Mon Sep 17 00:00:00 2001 From: Peter Harper <77111776+peterharperuk@users.noreply.github.com> Date: Thu, 21 Dec 2023 13:51:21 +0000 Subject: [PATCH] Freertos background asserts if IPv6 is enabled (#1591) If LWIP_IPV6=1 a request to update the multicast list occurs in a callback in the low priority interrupt. This makes an ioctl call into the driver, at the end of which is a call to cyw43_await_background_or_timeout_us (see CYW43_DO_IOCTL_WAIT). It is attempting to delay until there's "some work to do". For Freertos this fails an assertion as an attempt is made to acquire a semaphore in interrupt context. Fixes #1590 --- src/rp2_common/pico_cyw43_driver/cyw43_driver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rp2_common/pico_cyw43_driver/cyw43_driver.c b/src/rp2_common/pico_cyw43_driver/cyw43_driver.c index 6a3d01ce0..c472f0bf4 100644 --- a/src/rp2_common/pico_cyw43_driver/cyw43_driver.c +++ b/src/rp2_common/pico_cyw43_driver/cyw43_driver.c @@ -164,6 +164,10 @@ void cyw43_thread_lock_check(void) { #endif void cyw43_await_background_or_timeout_us(uint32_t timeout_us) { + if (__get_current_exception() > 0) { + async_context_wait_until(cyw43_async_context, make_timeout_time_us(timeout_us)); + return; + } async_context_wait_for_work_until(cyw43_async_context, make_timeout_time_us(timeout_us)); }