Skip to content

Commit 5324f46

Browse files
committed
make delay before cyw43 initialization a compile-time constant
1 parent e42b699 commit 5324f46

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

ports/raspberrypi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ CFLAGS_CYW43 := \
3232
-DCYW43_USE_STATS=0 \
3333
-DPICO_BUILD \
3434
-DCYW43_ENABLE_BLUETOOTH=0 \
35+
-DCIRCUITPY_CYW43_INIT_DELAY=$(CIRCUITPY_CYW43_INIT_DELAY) \
3536
-DPICO_CYW43_ARCH_POLL=0
3637

3738
SRC_SDK_CYW43 := \

ports/raspberrypi/mpconfigport.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ CIRCUITPY_ALARM ?= 1
5353
CIRCUITPY_PICODVI ?= 0
5454

5555
CIRCUITPY_TOUCHIO ?= 1
56+
57+
# delay in ms before calling cyw43_arch_init_with_country
58+
CIRCUITPY_CYW43_INIT_DELAY ?= 1000
5659
endif
5760

5861
ifeq ($(CHIP_VARIANT),RP2350)
@@ -65,6 +68,9 @@ CIRCUITPY_PICODVI ?= 1
6568
# So, turn touchio off because it doesn't work.
6669
CIRCUITPY_TOUCHIO = 0
6770

71+
# delay in ms before calling cyw43_arch_init_with_country
72+
CIRCUITPY_CYW43_INIT_DELAY ?= 0
73+
6874
# Audio effects
6975
CIRCUITPY_AUDIOEFFECTS ?= 1
7076
endif

ports/raspberrypi/supervisor/port.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "src/rp2_common/hardware_sync/include/hardware/sync.h"
4444
#include "src/rp2_common/hardware_timer/include/hardware/timer.h"
4545
#if CIRCUITPY_CYW43
46+
#include "py/mphal.h"
4647
#include "pico/cyw43_arch.h"
4748
#endif
4849
#include "src/common/pico_time/include/pico/time.h"
@@ -360,7 +361,7 @@ safe_mode_t port_init(void) {
360361
// initializing the cyw43 chip. Delays inside cyw43_arch_init_with_country
361362
// are intended to meet the power on timing requirements, but apparently
362363
// are inadequate. We'll back off this long delay based on future testing.
363-
mp_hal_delay_ms(1000);
364+
mp_hal_delay_ms(CIRCUITPY_CYW43_INIT_DELAY);
364365

365366
// Change this as a placeholder as to how to init with country code.
366367
// Default country code is CYW43_COUNTRY_WORLDWIDE)

0 commit comments

Comments
 (0)