From e42b6991f9759a87dc4553d44ceaff8ac1f5be6e Mon Sep 17 00:00:00 2001 From: Bernhard Bablok Date: Fri, 7 Feb 2025 10:44:19 +0100 Subject: [PATCH 1/2] removed delay before init of cyw43 --- ports/raspberrypi/supervisor/port.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index 5d2bf4115e7ef..b7460476feb7f 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -43,7 +43,6 @@ #include "src/rp2_common/hardware_sync/include/hardware/sync.h" #include "src/rp2_common/hardware_timer/include/hardware/timer.h" #if CIRCUITPY_CYW43 -#include "py/mphal.h" #include "pico/cyw43_arch.h" #endif #include "src/common/pico_time/include/pico/time.h" From 5324f46af0550b4ba2bfab6cb465b8c130317da0 Mon Sep 17 00:00:00 2001 From: Bernhard Bablok Date: Sat, 15 Feb 2025 12:48:39 +0100 Subject: [PATCH 2/2] make delay before cyw43 initialization a compile-time constant --- ports/raspberrypi/Makefile | 1 + ports/raspberrypi/mpconfigport.mk | 6 ++++++ ports/raspberrypi/supervisor/port.c | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 9e36a93490d3a..d1550a386e4ee 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -32,6 +32,7 @@ CFLAGS_CYW43 := \ -DCYW43_USE_STATS=0 \ -DPICO_BUILD \ -DCYW43_ENABLE_BLUETOOTH=0 \ + -DCIRCUITPY_CYW43_INIT_DELAY=$(CIRCUITPY_CYW43_INIT_DELAY) \ -DPICO_CYW43_ARCH_POLL=0 SRC_SDK_CYW43 := \ diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk index d619e78bd97a8..bb4e183461bec 100644 --- a/ports/raspberrypi/mpconfigport.mk +++ b/ports/raspberrypi/mpconfigport.mk @@ -53,6 +53,9 @@ CIRCUITPY_ALARM ?= 1 CIRCUITPY_PICODVI ?= 0 CIRCUITPY_TOUCHIO ?= 1 + +# delay in ms before calling cyw43_arch_init_with_country +CIRCUITPY_CYW43_INIT_DELAY ?= 1000 endif ifeq ($(CHIP_VARIANT),RP2350) @@ -65,6 +68,9 @@ CIRCUITPY_PICODVI ?= 1 # So, turn touchio off because it doesn't work. CIRCUITPY_TOUCHIO = 0 +# delay in ms before calling cyw43_arch_init_with_country +CIRCUITPY_CYW43_INIT_DELAY ?= 0 + # Audio effects CIRCUITPY_AUDIOEFFECTS ?= 1 endif diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index b7460476feb7f..026d9f629c57d 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -43,6 +43,7 @@ #include "src/rp2_common/hardware_sync/include/hardware/sync.h" #include "src/rp2_common/hardware_timer/include/hardware/timer.h" #if CIRCUITPY_CYW43 +#include "py/mphal.h" #include "pico/cyw43_arch.h" #endif #include "src/common/pico_time/include/pico/time.h" @@ -360,7 +361,7 @@ safe_mode_t port_init(void) { // initializing the cyw43 chip. Delays inside cyw43_arch_init_with_country // are intended to meet the power on timing requirements, but apparently // are inadequate. We'll back off this long delay based on future testing. - mp_hal_delay_ms(1000); + mp_hal_delay_ms(CIRCUITPY_CYW43_INIT_DELAY); // Change this as a placeholder as to how to init with country code. // Default country code is CYW43_COUNTRY_WORLDWIDE)