From 49bf38e4fdede8ececf6fa816aedd4a4d30a18ad Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Wed, 25 Sep 2024 11:10:52 +0100 Subject: [PATCH] PPP2: Add wireless. --- .github/workflows/micropython.yml | 2 +- .../board/PIMORONI_PICO_PLUS2/mpconfigboard.h | 42 ++++++++++++++++--- .../mpconfigvariant_WIRELESS.cmake | 1 + .../pimoroni_pico_plus2w_rp2350.h | 8 ++-- micropython/board/manifest_pico2.py | 3 ++ 5 files changed, 46 insertions(+), 10 deletions(-) diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 597a27d..20efd39 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -7,7 +7,7 @@ on: types: [created] env: - MICROPYTHON_VERSION: feature/psram + MICROPYTHON_VERSION: feature/spicy-wifi MICROPYTHON_FLAVOUR: pimoroni PIMORONI_PICO_VERSION: feature/sdk-2.0.0 diff --git a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.h b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.h index 34f260c..7ee44ec 100644 --- a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.h +++ b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.h @@ -1,14 +1,10 @@ // Board and hardware specific configuration -#ifndef MICROPY_HW_BOARD_NAME -// Might be defined by mpconfigvariant.cmake -#define MICROPY_HW_BOARD_NAME "Pimoroni Pico Plus 2" -#endif #define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - (2 * 1024 * 1024)) #define MICROPY_HW_PSRAM_CS_PIN PIMORONI_PICO_PLUS2_PSRAM_CS_PIN // Might be defined in mpconfigvariant_PSRAM.cmake -// or mpconfigvariant_PPP.cmake +// or mpconfigvariant_WIRELESS.cmake #if defined(MICROPY_HW_ENABLE_PSRAM) #define MICROPY_GC_SPLIT_HEAP (1) @@ -28,6 +24,35 @@ #define MICROPY_HW_PIN_EXT_COUNT CYW43_WL_GPIO_COUNT +#if defined(CYW43_PIN_WL_DYNAMIC) + +#define CYW43_PIO_CLOCK_DIV_DYNAMIC (1) + +// Defined by pimoroni_pico_plus2w_rp2350.h +//#define CYW43_DEFAULT_PIN_WL_HOST_WAKE SPICE_RESET_MOSI_PIN +//#define CYW43_DEFAULT_PIN_WL_REG_ON SPICE_TX_MISO_PIN +#define CYW43_DEFAULT_PIN_WL_DATA_OUT CYW43_DEFAULT_PIN_WL_HOST_WAKE +#define CYW43_DEFAULT_PIN_WL_DATA_IN CYW43_DEFAULT_PIN_WL_HOST_WAKE +#define CYW43_DEFAULT_PIN_WL_CLOCK 29u +#define CYW43_DEFAULT_PIN_WL_CS 25u + +/* SPICE alternative +#define CYW43_DEFAULT_PIN_WL_HOST_WAKE SPICE_RESET_MOSI_PIN +#define CYW43_DEFAULT_PIN_WL_REG_ON SPICE_TX_MISO_PIN +#define CYW43_DEFAULT_PIN_WL_DATA_OUT SPICE_RESET_MOSI_PIN +#define CYW43_DEFAULT_PIN_WL_DATA_IN SPICE_RESET_MOSI_PIN +#define CYW43_DEFAULT_PIN_WL_CLOCK SPICE_NETLIGHT_SCK_PIN +#define CYW43_DEFAULT_PIN_WL_CS SPICE_RX_CS_PIN +*/ + +// Slow down the wireless clock, since we'll be running +// comms through wiring spaghetti! +#define CYW43_PIO_CLOCK_DIV_INT 50 +#define CYW43_PIO_CLOCK_DIV_FRAC 0 +#define CYW43_SPI_PROGRAM_NAME spi_gap0_sample1 + +#endif + #endif // Might be defined in mpconfigvariant_PPP.cmake @@ -36,4 +61,11 @@ // Nothing to do here? +#endif + +// If a variant is not used, define a fallback board name +#ifndef MICROPY_HW_BOARD_NAME + +#define MICROPY_HW_BOARD_NAME "Pimoroni Pico Plus 2" + #endif \ No newline at end of file diff --git a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_WIRELESS.cmake b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_WIRELESS.cmake index 9d300ad..6de4e4f 100644 --- a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_WIRELESS.cmake +++ b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_WIRELESS.cmake @@ -4,6 +4,7 @@ list(APPEND MICROPY_DEF_BOARD "MICROPY_HW_BOARD_NAME=\"Pimoroni Pico Plus 2 (Wireless + PSRAM)\"" "MICROPY_HW_ENABLE_PSRAM=1" "MICROPY_PY_NETWORK=1" + "CYW43_PIN_WL_DYNAMIC=1" "MICROPY_PY_NETWORK_PPP_LWIP=1" ) diff --git a/micropython/board/PIMORONI_PICO_PLUS2/pimoroni_pico_plus2w_rp2350.h b/micropython/board/PIMORONI_PICO_PLUS2/pimoroni_pico_plus2w_rp2350.h index c0ff5d7..f7a716f 100644 --- a/micropython/board/PIMORONI_PICO_PLUS2/pimoroni_pico_plus2w_rp2350.h +++ b/micropython/board/PIMORONI_PICO_PLUS2/pimoroni_pico_plus2w_rp2350.h @@ -32,12 +32,12 @@ #define PIMORONI_PICO_PLUS2_PSRAM_CS_PIN 47 // -- CYW43 Wireless -- -#ifndef CYW43_PIN_WL_HOST_WAKE -#define CYW43_PIN_WL_HOST_WAKE 24 +#ifndef CYW43_DEFAULT_PIN_WL_HOST_WAKE +#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 24 #endif -#ifndef CYW43_PIN_WL_REG_ON -#define CYW43_PIN_WL_REG_ON 23 +#ifndef CYW43_DEFAULT_PIN_WL_REG_ON +#define CYW43_DEFAULT_PIN_WL_REG_ON 23 #endif #ifndef CYW43_WL_GPIO_COUNT diff --git a/micropython/board/manifest_pico2.py b/micropython/board/manifest_pico2.py index df993ee..a400fdc 100644 --- a/micropython/board/manifest_pico2.py +++ b/micropython/board/manifest_pico2.py @@ -1,5 +1,8 @@ MODULES_PY = "../../../pimoroni-pico/micropython/modules_py" +# SD Card +require("sdcard") + freeze(MODULES_PY, "gfx_pack.py") freeze(MODULES_PY, "pimoroni.py")