From 345f1d23957be43e1157463a6405ba9cb04bd43d Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Tue, 8 Nov 2022 16:17:59 +0100 Subject: [PATCH] rp2/cyw43_configport: Make sure only core0 executes a __WFI(). This commit executes __WFI() on core 0 only to avoid core1 locking up since it doesn't enable any interrupts by default (except for `SIO_IRQ_PROC1`). This fixes a lockup when calling `cyw43_do_ioctl` from core1. Fixes issue #9597. --- ports/rp2/cyw43_configport.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ports/rp2/cyw43_configport.h b/ports/rp2/cyw43_configport.h index a5ce8a9e7..848fb9dbf 100644 --- a/ports/rp2/cyw43_configport.h +++ b/ports/rp2/cyw43_configport.h @@ -47,8 +47,15 @@ #define CYW43_THREAD_EXIT MICROPY_PY_LWIP_EXIT #define CYW43_THREAD_LOCK_CHECK -#define CYW43_SDPCM_SEND_COMMON_WAIT __WFI(); -#define CYW43_DO_IOCTL_WAIT __WFI(); +#define CYW43_SDPCM_SEND_COMMON_WAIT \ + if (get_core_num() == 0) { \ + __WFI(); \ + } \ + +#define CYW43_DO_IOCTL_WAIT \ + if (get_core_num() == 0) { \ + __WFI(); \ + } \ #define CYW43_ARRAY_SIZE(a) MP_ARRAY_SIZE(a)