From 98ff22ccfab9dbce123a8e0b2c196d73035ef1d6 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Wed, 6 Nov 2024 16:31:27 +0000 Subject: [PATCH] PPP/Plasma: Simplify config. Since both PPP2 or Plasma2350 have a SP/CE connector, enable WiFi in all cases. Additionally enable PPP in all cases. Finally, drop the non-PSRAM build. (TBC if it returns, since it's less RAM but faster.) --- .github/workflows/micropython.yml | 9 -- .../PIMORONI_PICO_PLUS2/manifest-wireless.py | 8 -- .../board/PIMORONI_PICO_PLUS2/manifest.py | 9 +- .../PIMORONI_PICO_PLUS2/mpconfigboard.cmake | 32 ++++- .../board/PIMORONI_PICO_PLUS2/mpconfigboard.h | 76 +++-------- .../PIMORONI_PICO_PLUS2/mpconfigvariant.cmake | 0 .../mpconfigvariant_PSRAM.cmake | 6 - .../mpconfigvariant_WIRELESS.cmake | 41 ------ .../pimoroni_pico_plus2w_rp2350.h | 84 ++++++++----- .../PIMORONI_PLASMA2350/manifest-wireless.py | 8 -- .../board/PIMORONI_PLASMA2350/manifest.py | 9 +- .../PIMORONI_PLASMA2350/mpconfigboard.cmake | 34 ++++- .../board/PIMORONI_PLASMA2350/mpconfigboard.h | 62 ++------- .../PIMORONI_PLASMA2350/mpconfigvariant.cmake | 0 .../mpconfigvariant_WIRELESS.cmake | 40 ------ .../PIMORONI_PLASMA2350/pimoroni_plasma2350.h | 119 ------------------ .../pimoroni_plasma2350w.h | 95 ++++++++++---- .../board/PIMORONI_PLASMA2350/pins.csv | 5 +- 18 files changed, 228 insertions(+), 409 deletions(-) delete mode 100644 micropython/board/PIMORONI_PICO_PLUS2/manifest-wireless.py delete mode 100644 micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant.cmake delete mode 100644 micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_PSRAM.cmake delete mode 100644 micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_WIRELESS.cmake delete mode 100644 micropython/board/PIMORONI_PLASMA2350/manifest-wireless.py delete mode 100644 micropython/board/PIMORONI_PLASMA2350/mpconfigvariant.cmake delete mode 100644 micropython/board/PIMORONI_PLASMA2350/mpconfigvariant_WIRELESS.cmake delete mode 100644 micropython/board/PIMORONI_PLASMA2350/pimoroni_plasma2350.h diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 1fe4b95..62b35f8 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -28,17 +28,8 @@ jobs: board: RPI_PICO2B - name: plasma2350 board: PIMORONI_PLASMA2350 - - name: plasma2350_wireless - board: PIMORONI_PLASMA2350 - variant: WIRELESS - name: tiny2350 board: PIMORONI_TINY2350 - - name: pico_plus2_rp2350_psram - board: PIMORONI_PICO_PLUS2 - variant: PSRAM - - name: pico_plus2_rp2350_wireless - board: PIMORONI_PICO_PLUS2 - variant: WIRELESS - name: pico_plus2_rp2350 board: PIMORONI_PICO_PLUS2 diff --git a/micropython/board/PIMORONI_PICO_PLUS2/manifest-wireless.py b/micropython/board/PIMORONI_PICO_PLUS2/manifest-wireless.py deleted file mode 100644 index b34f473..0000000 --- a/micropython/board/PIMORONI_PICO_PLUS2/manifest-wireless.py +++ /dev/null @@ -1,8 +0,0 @@ -require("bundle-networking") - -# Bluetooth -require("aioble") - -include("manifest.py") - -freeze("$(BOARD_DIR)/../../modules_py", "lte.py") \ No newline at end of file diff --git a/micropython/board/PIMORONI_PICO_PLUS2/manifest.py b/micropython/board/PIMORONI_PICO_PLUS2/manifest.py index fb2a59b..ab6e69e 100644 --- a/micropython/board/PIMORONI_PICO_PLUS2/manifest.py +++ b/micropython/board/PIMORONI_PICO_PLUS2/manifest.py @@ -1,3 +1,10 @@ +require("bundle-networking") + +# Bluetooth +require("aioble") + include("$(PORT_DIR)/boards/manifest.py") -include("../manifest_pico2.py") \ No newline at end of file +include("../manifest_pico2.py") + +freeze("$(BOARD_DIR)/../../modules_py", "lte.py") \ No newline at end of file diff --git a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.cmake b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.cmake index 9a18365..63092b6 100644 --- a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.cmake +++ b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.cmake @@ -1,5 +1,6 @@ # cmake file for Raspberry Pi Pico -set(PICO_BOARD "pimoroni_pico_plus2_rp2350") +set(PICO_BOARD "pimoroni_pico_plus2w_rp2350") +set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}) set(PICO_PLATFORM "rp2350") set(PICO_NUM_GPIOS 48) @@ -7,3 +8,32 @@ set(PICO_NUM_GPIOS 48) set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) set(MICROPY_C_HEAP_SIZE 4096) + +# Links micropy_lib_lwip and sets MICROPY_PY_LWIP = 1 +# Picked up and expanded upon in mpconfigboard.h +set(MICROPY_PY_LWIP ON) + +# Links cyw43-driver and sets: +# MICROPY_PY_NETWORK_CYW43 = 1, +# MICROPY_PY_SOCKET_DEFAULT_TIMEOUT_MS = 30000 +set(MICROPY_PY_NETWORK_CYW43 ON) + +# Adds mpbthciport.c +# And sets: +# MICROPY_PY_BLUETOOTH = 1, +# MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS = 1, +# MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE = 1 +set(MICROPY_PY_BLUETOOTH ON) + +# Links pico_btstack_hci_transport_cyw43 +# And sets: +# MICROPY_BLUETOOTH_BTSTACK = 1, +# MICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE = +set(MICROPY_BLUETOOTH_BTSTACK ON) + +# Sets: +# CYW43_ENABLE_BLUETOOTH = 1, +# MICROPY_PY_BLUETOOTH_CYW43 = 1 +set(MICROPY_PY_BLUETOOTH_CYW43 ON) + + diff --git a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.h b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.h index 4fd3d44..4d3e7bf 100644 --- a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.h +++ b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigboard.h @@ -1,28 +1,14 @@ // Board and hardware specific configuration #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 - -#ifndef CYW43_WL_GPIO_COUNT -// Effecively remaps LEDW,EXT_GPIO0 to GPIO25 on non-W builds -#define pin_EXT_GPIO0 pin_GPIO25 -// Shim the EXT GPIOs because we can't specify a variant pins.csv -#define pin_EXT_GPIO1 pin_GPIO1 -#define pin_EXT_GPIO2 pin_GPIO2 -#endif - -// Might be defined in mpconfigvariant_PSRAM.cmake -// or mpconfigvariant_WIRELESS.cmake -#if defined(MICROPY_HW_ENABLE_PSRAM) - -#define MICROPY_GC_SPLIT_HEAP (1) - -#endif - // Set up networking. #define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "PPP2" -#if defined(MICROPY_PY_NETWORK_CYW43) +#define MICROPY_HW_BOARD_NAME "Pimoroni Pico Plus 2 (PSRAM + LTE + WiFi)" + +// Enable WiFi & PPP +#define MICROPY_PY_NETWORK (1) +#define MICROPY_PY_NETWORK_PPP_LWIP (1) // CYW43 driver configuration. #define CYW43_USE_SPI (1) @@ -30,50 +16,16 @@ #define CYW43_GPIO (1) #define CYW43_SPI_PIO (1) -#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 - +#ifndef CYW43_WL_GPIO_COUNT +#define CYW43_WL_GPIO_COUNT 3 #endif -#endif +#define MICROPY_HW_PIN_EXT_COUNT CYW43_WL_GPIO_COUNT -// Might be defined in mpconfigvariant_PPP.cmake -// This is not checked by mpconfigport.h so we must set up networking below -#if defined(MICROPY_PY_NETWORK_PPP_LWIP) +int mp_hal_is_pin_reserved(int n); +#define MICROPY_HW_PIN_RESERVED(i) mp_hal_is_pin_reserved(i) -// 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 +// PSRAM Settings +#define MICROPY_HW_ENABLE_PSRAM (1) +#define MICROPY_HW_PSRAM_CS_PIN PIMORONI_PICO_PLUS2_PSRAM_CS_PIN +#define MICROPY_GC_SPLIT_HEAP (1) diff --git a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant.cmake b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant.cmake deleted file mode 100644 index e69de29..0000000 diff --git a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_PSRAM.cmake b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_PSRAM.cmake deleted file mode 100644 index eedd565..0000000 --- a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_PSRAM.cmake +++ /dev/null @@ -1,6 +0,0 @@ -# Override the MicroPython board name -# And set basic options which are expanded upon in mpconfigboard.h -list(APPEND MICROPY_DEF_BOARD - "MICROPY_HW_BOARD_NAME=\"Pimoroni Pico Plus 2 (PSRAM)\"" - "MICROPY_HW_ENABLE_PSRAM=1" -) diff --git a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_WIRELESS.cmake b/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_WIRELESS.cmake deleted file mode 100644 index 6de4e4f..0000000 --- a/micropython/board/PIMORONI_PICO_PLUS2/mpconfigvariant_WIRELESS.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# Override the MicroPython board name -# And set basic options which are expanded upon in mpconfigboard.h -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" -) - -# Links micropy_lib_lwip and sets MICROPY_PY_LWIP = 1 -# Picked up and expanded upon in mpconfigboard.h -set(MICROPY_PY_LWIP ON) - -# Links cyw43-driver and sets: -# MICROPY_PY_NETWORK_CYW43 = 1, -# MICROPY_PY_SOCKET_DEFAULT_TIMEOUT_MS = 30000 -set(MICROPY_PY_NETWORK_CYW43 ON) - -# Adds mpbthciport.c -# And sets: -# MICROPY_PY_BLUETOOTH = 1, -# MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS = 1, -# MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE = 1 -set(MICROPY_PY_BLUETOOTH ON) - -# Links pico_btstack_hci_transport_cyw43 -# And sets: -# MICROPY_BLUETOOTH_BTSTACK = 1, -# MICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE = -set(MICROPY_BLUETOOTH_BTSTACK ON) - -# Sets: -# CYW43_ENABLE_BLUETOOTH = 1, -# MICROPY_PY_BLUETOOTH_CYW43 = 1 -set(MICROPY_PY_BLUETOOTH_CYW43 ON) - -set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest-wireless.py) - -set(PICO_BOARD "pimoroni_pico_plus2w_rp2350") -set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}) 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 f7a716f..aa2c987 100644 --- a/micropython/board/PIMORONI_PICO_PLUS2/pimoroni_pico_plus2w_rp2350.h +++ b/micropython/board/PIMORONI_PICO_PLUS2/pimoroni_pico_plus2w_rp2350.h @@ -31,35 +31,6 @@ #define PIMORONI_PICO_PLUS2_USER_SW_PIN 45 #define PIMORONI_PICO_PLUS2_PSRAM_CS_PIN 47 -// -- CYW43 Wireless -- -#ifndef CYW43_DEFAULT_PIN_WL_HOST_WAKE -#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 24 -#endif - -#ifndef CYW43_DEFAULT_PIN_WL_REG_ON -#define CYW43_DEFAULT_PIN_WL_REG_ON 23 -#endif - -#ifndef CYW43_WL_GPIO_COUNT -#define CYW43_WL_GPIO_COUNT 3 -#endif - -#ifndef CYW43_WL_GPIO_LED_PIN -#define CYW43_WL_GPIO_LED_PIN 0 -#endif - -// If CYW43_WL_GPIO_VBUS_PIN is defined then a CYW43 GPIO has to be used to read VBUS. -// This can be passed to cyw43_arch_gpio_get to determine if the device is battery powered. -// PICO_VBUS_PIN and CYW43_WL_GPIO_VBUS_PIN should not both be defined. - -// no CYW43_WL_GPIO_VBUS_PIN - -// If CYW43_USES_VSYS_PIN is defined then CYW43 uses the VSYS GPIO (defined by PICO_VSYS_PIN) for other purposes. -// If this is the case, to use the VSYS GPIO it's necessary to ensure CYW43 is not using it. -// This can be achieved by wrapping the use of the VSYS GPIO in cyw43_thread_enter / cyw43_thread_exit. - -// no CYW43_USES_VSYS_PIN - // --- UART --- #ifndef PICO_DEFAULT_UART #define PICO_DEFAULT_UART 0 @@ -118,6 +89,26 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +#ifndef CYW43_WL_GPIO_COUNT +#define CYW43_WL_GPIO_COUNT 3 +#endif + +#ifndef CYW43_WL_GPIO_LED_PIN +#define CYW43_WL_GPIO_LED_PIN 0 +#endif + +// If CYW43_WL_GPIO_VBUS_PIN is defined then a CYW43 GPIO has to be used to read VBUS. +// This can be passed to cyw43_arch_gpio_get to determine if the device is battery powered. +// PICO_VBUS_PIN and CYW43_WL_GPIO_VBUS_PIN should not both be defined. + +// no CYW43_WL_GPIO_VBUS_PIN + +// If CYW43_USES_VSYS_PIN is defined then CYW43 uses the VSYS GPIO (defined by PICO_VSYS_PIN) for other purposes. +// If this is the case, to use the VSYS GPIO it's necessary to ensure CYW43 is not using it. +// This can be achieved by wrapping the use of the VSYS GPIO in cyw43_thread_enter / cyw43_thread_exit. + +// no CYW43_USES_VSYS_PIN + // The GPIO Pin used to read VBUS to determine if the device is battery powered. #ifndef PICO_VBUS_PIN #define PICO_VBUS_PIN 24 @@ -133,4 +124,39 @@ #define PICO_RP2350_A2_SUPPORTED 1 #endif +// PICO_CONFIG: CYW43_PIN_WL_DYNAMIC, flag to indicate if cyw43 SPI pins can be changed at runtime, type=bool, default=false, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_PIN_WL_DYNAMIC +#define CYW43_PIN_WL_DYNAMIC 1 +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_REG_ON, gpio pin to power up the cyw43 chip, type=int, default=23, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_REG_ON +#define CYW43_DEFAULT_PIN_WL_REG_ON 23u +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_OUT, gpio pin for spi data out to the cyw43 chip, type=int, default=24, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_DATA_OUT +#define CYW43_DEFAULT_PIN_WL_DATA_OUT 24u +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_IN, gpio pin for spi data in from the cyw43 chip, type=int, default=24, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_DATA_IN +#define CYW43_DEFAULT_PIN_WL_DATA_IN 24u +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_HOST_WAKE, gpio (irq) pin for the irq line from the cyw43 chip, type=int, default=24, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_HOST_WAKE +#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 24u +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CLOCK, gpio pin for the spi clock line to the cyw43 chip, type=int, default=29, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_CLOCK +#define CYW43_DEFAULT_PIN_WL_CLOCK 29u +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CS, gpio pin for the spi chip select to the cyw43 chip, type=int, default=25, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_CS +#define CYW43_DEFAULT_PIN_WL_CS 25u +#endif + #endif \ No newline at end of file diff --git a/micropython/board/PIMORONI_PLASMA2350/manifest-wireless.py b/micropython/board/PIMORONI_PLASMA2350/manifest-wireless.py deleted file mode 100644 index b34f473..0000000 --- a/micropython/board/PIMORONI_PLASMA2350/manifest-wireless.py +++ /dev/null @@ -1,8 +0,0 @@ -require("bundle-networking") - -# Bluetooth -require("aioble") - -include("manifest.py") - -freeze("$(BOARD_DIR)/../../modules_py", "lte.py") \ No newline at end of file diff --git a/micropython/board/PIMORONI_PLASMA2350/manifest.py b/micropython/board/PIMORONI_PLASMA2350/manifest.py index fb2a59b..ab6e69e 100644 --- a/micropython/board/PIMORONI_PLASMA2350/manifest.py +++ b/micropython/board/PIMORONI_PLASMA2350/manifest.py @@ -1,3 +1,10 @@ +require("bundle-networking") + +# Bluetooth +require("aioble") + include("$(PORT_DIR)/boards/manifest.py") -include("../manifest_pico2.py") \ No newline at end of file +include("../manifest_pico2.py") + +freeze("$(BOARD_DIR)/../../modules_py", "lte.py") \ No newline at end of file diff --git a/micropython/board/PIMORONI_PLASMA2350/mpconfigboard.cmake b/micropython/board/PIMORONI_PLASMA2350/mpconfigboard.cmake index d8fc435..1516676 100644 --- a/micropython/board/PIMORONI_PLASMA2350/mpconfigboard.cmake +++ b/micropython/board/PIMORONI_PLASMA2350/mpconfigboard.cmake @@ -1,5 +1,6 @@ -# cmake file for Raspberry Pi Pico -set(PICO_BOARD "pimoroni_plasma2350") +# cmake file for Pimoroni Plasma 2350 +set(PICO_BOARD "pimoroni_plasma2350w") +set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}) set(PICO_PLATFORM "rp2350") # Board specific version of the frozen manifest @@ -7,5 +8,30 @@ set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) set(MICROPY_C_HEAP_SIZE 4096) -set(PICO_BOARD "pimoroni_plasma2350") -set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}) +# Links micropy_lib_lwip and sets MICROPY_PY_LWIP = 1 +# Picked up and expanded upon in mpconfigboard.h +set(MICROPY_PY_LWIP ON) + +# Links cyw43-driver and sets: +# MICROPY_PY_NETWORK_CYW43 = 1, +# MICROPY_PY_SOCKET_DEFAULT_TIMEOUT_MS = 30000 +set(MICROPY_PY_NETWORK_CYW43 ON) + +# Adds mpbthciport.c +# And sets: +# MICROPY_PY_BLUETOOTH = 1, +# MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS = 1, +# MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE = 1 +set(MICROPY_PY_BLUETOOTH ON) + +# Links pico_btstack_hci_transport_cyw43 +# And sets: +# MICROPY_BLUETOOTH_BTSTACK = 1, +# MICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE = +set(MICROPY_BLUETOOTH_BTSTACK ON) + +# Sets: +# CYW43_ENABLE_BLUETOOTH = 1, +# MICROPY_PY_BLUETOOTH_CYW43 = 1 +set(MICROPY_PY_BLUETOOTH_CYW43 ON) + diff --git a/micropython/board/PIMORONI_PLASMA2350/mpconfigboard.h b/micropython/board/PIMORONI_PLASMA2350/mpconfigboard.h index d99e39a..08b6314 100644 --- a/micropython/board/PIMORONI_PLASMA2350/mpconfigboard.h +++ b/micropython/board/PIMORONI_PLASMA2350/mpconfigboard.h @@ -1,14 +1,6 @@ // Board and hardware specific configuration #define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - (2 * 1024 * 1024)) -#ifndef CYW43_WL_GPIO_COUNT -// Shim the EXT GPIOs because we can't specify a variant pins.csv -// Remap them to LED R, G and B respectively on non-W builds -#define pin_EXT_GPIO0 pin_GPIO16 -#define pin_EXT_GPIO1 pin_GPIO17 -#define pin_EXT_GPIO2 pin_GPIO18 -#endif - // I2C0 (non-default) #define MICROPY_HW_I2C0_SCL (PLASMA2350_SDA_PIN) #define MICROPY_HW_I2C0_SDA (PLASMA2350_SCL_PIN) @@ -16,7 +8,11 @@ // Set up networking. #define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "PLASMA2350" -#if defined(MICROPY_PY_NETWORK_CYW43) +#define MICROPY_HW_BOARD_NAME "Pimoroni Plasma 2350 (LTE + WiFi)" + +// Enable WiFi & PPP +#define MICROPY_PY_NETWORK (1) +#define MICROPY_PY_NETWORK_PPP_LWIP (1) // CYW43 driver configuration. #define CYW43_USE_SPI (1) @@ -24,50 +20,12 @@ #define CYW43_GPIO (1) #define CYW43_SPI_PIO (1) -#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 - +#ifndef CYW43_WL_GPIO_COUNT +#define CYW43_WL_GPIO_COUNT 3 #endif -#endif +#define MICROPY_HW_PIN_EXT_COUNT CYW43_WL_GPIO_COUNT -// Might be defined in mpconfigvariant_PPP.cmake -// This is not checked by mpconfigport.h so we must set up networking below -#if defined(MICROPY_PY_NETWORK_PPP_LWIP) +int mp_hal_is_pin_reserved(int n); +#define MICROPY_HW_PIN_RESERVED(i) mp_hal_is_pin_reserved(i) -// 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 Plasma 2350" - -#endif \ No newline at end of file diff --git a/micropython/board/PIMORONI_PLASMA2350/mpconfigvariant.cmake b/micropython/board/PIMORONI_PLASMA2350/mpconfigvariant.cmake deleted file mode 100644 index e69de29..0000000 diff --git a/micropython/board/PIMORONI_PLASMA2350/mpconfigvariant_WIRELESS.cmake b/micropython/board/PIMORONI_PLASMA2350/mpconfigvariant_WIRELESS.cmake deleted file mode 100644 index 2aee992..0000000 --- a/micropython/board/PIMORONI_PLASMA2350/mpconfigvariant_WIRELESS.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# Override the MicroPython board name -# And set basic options which are expanded upon in mpconfigboard.h -list(APPEND MICROPY_DEF_BOARD - "MICROPY_HW_BOARD_NAME=\"Pimoroni Plasma 2350 (LTE + WiFi)\"" - "MICROPY_PY_NETWORK=1" - "CYW43_PIN_WL_DYNAMIC=1" - "MICROPY_PY_NETWORK_PPP_LWIP=1" -) - -# Links micropy_lib_lwip and sets MICROPY_PY_LWIP = 1 -# Picked up and expanded upon in mpconfigboard.h -set(MICROPY_PY_LWIP ON) - -# Links cyw43-driver and sets: -# MICROPY_PY_NETWORK_CYW43 = 1, -# MICROPY_PY_SOCKET_DEFAULT_TIMEOUT_MS = 30000 -set(MICROPY_PY_NETWORK_CYW43 ON) - -# Adds mpbthciport.c -# And sets: -# MICROPY_PY_BLUETOOTH = 1, -# MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS = 1, -# MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE = 1 -set(MICROPY_PY_BLUETOOTH ON) - -# Links pico_btstack_hci_transport_cyw43 -# And sets: -# MICROPY_BLUETOOTH_BTSTACK = 1, -# MICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE = -set(MICROPY_BLUETOOTH_BTSTACK ON) - -# Sets: -# CYW43_ENABLE_BLUETOOTH = 1, -# MICROPY_PY_BLUETOOTH_CYW43 = 1 -set(MICROPY_PY_BLUETOOTH_CYW43 ON) - -set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest-wireless.py) - -set(PICO_BOARD "pimoroni_plasma2350w") -set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}) diff --git a/micropython/board/PIMORONI_PLASMA2350/pimoroni_plasma2350.h b/micropython/board/PIMORONI_PLASMA2350/pimoroni_plasma2350.h deleted file mode 100644 index 9aeb28b..0000000 --- a/micropython/board/PIMORONI_PLASMA2350/pimoroni_plasma2350.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -// ----------------------------------------------------- -// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO -// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES -// ----------------------------------------------------- - -// This header may be included by other board headers as "boards/pimoroni_plasma2350.h" - -// pico_cmake_set PICO_PLATFORM=rp2350 - -#ifndef _BOARDS_PIMORONI_PLASMA2350_H -#define _BOARDS_PIMORONI_PLASMA2350_H - -// For board detection -#define PIMORONI_PLASMA2350 - -// --- BOARD SPECIFIC --- -#define SPICE_SPI 0 -#define SPICE_TX_MISO_PIN 8 -#define SPICE_RX_CS_PIN 9 -#define SPICE_NETLIGHT_SCK_PIN 10 -#define SPICE_RESET_MOSI_PIN 11 -#define SPICE_PWRKEY_BL_PIN 7 - -#define PLASMA2350_SW_A_PIN 12 - -#define PLASMA2350_CLK_PIN 14 -#define PLASMA2350_DATA_PIN 15 - -#define PLASMA2350_LED_R_PIN 16 -#define PLASMA2350_LED_G_PIN 17 -#define PLASMA2350_LED_B_PIN 18 - -#define PLASMA2350_I2C 0 -#define PLASMA2350_INT_PIN 19 -#define PLASMA2350_SDA_PIN 20 -#define PLASMA2350_SCL_PIN 21 - -#define PLASMA2350_USER_SW_PIN 22 - -#define PLASMA2350_A0_PIN 26 -#define PLASMA2350_A1_PIN 27 -#define PLASMA2350_A2_PIN 28 -#define PLASMA2350_NUM_ADC_PINS 3 - -#define PLASMA2350_CURRENT_SENSE_PIN 29 - -// --- RP2350 VARIANT --- -#define PICO_RP2350A 1 - -// --- UART --- -// no PICO_DEFAULT_UART -// no PICO_DEFAULT_UART_TX_PIN -// no PICO_DEFAULT_UART_RX_PIN - -// --- LED --- -#ifndef PICO_DEFAULT_LED_PIN -#define PICO_DEFAULT_LED_PIN TINY2350_LED_G_PIN -#endif -// no PICO_DEFAULT_WS2812_PIN - -#ifndef PICO_DEFAULT_LED_PIN_INVERTED -#define PICO_DEFAULT_LED_PIN_INVERTED 1 -#endif - -// --- I2C --- -// routed to Qw/St connector -#ifndef PICO_DEFAULT_I2C -#define PICO_DEFAULT_I2C PLASMA2350_I2C -#endif -#ifndef PICO_DEFAULT_I2C_SDA_PIN -#define PICO_DEFAULT_I2C_SDA_PIN PLASMA2350_SDA_PIN -#endif -#ifndef PICO_DEFAULT_I2C_SCL_PIN -#define PICO_DEFAULT_I2C_SCL_PIN PLASMA2350_SCL_PIN -#endif - -// --- SPI --- -#ifndef PICO_DEFAULT_SPI -#define PICO_DEFAULT_SPI 0 -#endif -#ifndef PICO_DEFAULT_SPI_SCK_PIN -#define PICO_DEFAULT_SPI_SCK_PIN SPICE_NETLIGHT_SCK_PIN -#endif -#ifndef PICO_DEFAULT_SPI_TX_PIN -#define PICO_DEFAULT_SPI_TX_PIN SPICE_RESET_MOSI_PIN -#endif -#ifndef PICO_DEFAULT_SPI_RX_PIN -#define PICO_DEFAULT_SPI_RX_PIN SPICE_TX_MISO_PIN -#endif -#ifndef PICO_DEFAULT_SPI_CSN_PIN -#define PICO_DEFAULT_SPI_CSN_PIN SPICE_RX_CS_PIN -#endif - -// --- FLASH --- -#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 - -#ifndef PICO_FLASH_SPI_CLKDIV -#define PICO_FLASH_SPI_CLKDIV 2 -#endif - -// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (4 * 1024 * 1024) -#ifndef PICO_FLASH_SIZE_BYTES -#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) -#endif - -#ifndef PICO_RP2350_A2_SUPPORTED -#define PICO_RP2350_A2_SUPPORTED 1 -#endif - -// no PICO_VBUS_PIN -// no PICO_VSYS_PIN - -#endif \ No newline at end of file diff --git a/micropython/board/PIMORONI_PLASMA2350/pimoroni_plasma2350w.h b/micropython/board/PIMORONI_PLASMA2350/pimoroni_plasma2350w.h index 4a721f9..499d630 100644 --- a/micropython/board/PIMORONI_PLASMA2350/pimoroni_plasma2350w.h +++ b/micropython/board/PIMORONI_PLASMA2350/pimoroni_plasma2350w.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. + * Copyright (c) 2024 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -9,12 +9,13 @@ // SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES // ----------------------------------------------------- -// This header may be included by other board headers as "boards/pimoroni_plasma2350.h" +// This header may be included by other board headers as "boards/pico2_w.h" // pico_cmake_set PICO_PLATFORM=rp2350 +// pico_cmake_set PICO_CYW43_SUPPORTED = 1 -#ifndef _BOARDS_PIMORONI_PLASMA2350W_H -#define _BOARDS_PIMORONI_PLASMA2350W_H +#ifndef _BOARDS_PICO2_W_H +#define _BOARDS_PICO2_W_H // For board detection #define PIMORONI_PLASMA2350 @@ -51,23 +52,6 @@ #define PLASMA2350_CURRENT_SENSE_PIN 29 -// -- CYW43 Wireless -- -#ifndef CYW43_DEFAULT_PIN_WL_HOST_WAKE -#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 24 -#endif - -#ifndef CYW43_DEFAULT_PIN_WL_REG_ON -#define CYW43_DEFAULT_PIN_WL_REG_ON 23 -#endif - -#ifndef CYW43_WL_GPIO_COUNT -#define CYW43_WL_GPIO_COUNT 3 -#endif - -#ifndef CYW43_WL_GPIO_LED_PIN -#define CYW43_WL_GPIO_LED_PIN 0 -#endif - // --- RP2350 VARIANT --- #define PICO_RP2350A 1 @@ -116,6 +100,7 @@ #endif // --- FLASH --- + #define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 #ifndef PICO_FLASH_SPI_CLKDIV @@ -126,12 +111,74 @@ #ifndef PICO_FLASH_SIZE_BYTES #define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) #endif +// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads) +// note the SMSP mode pin is on WL_GPIO1 + +#ifndef CYW43_WL_GPIO_COUNT +#define CYW43_WL_GPIO_COUNT 3 +#endif + +#ifndef CYW43_WL_GPIO_LED_PIN +#define CYW43_WL_GPIO_LED_PIN 0 +#endif + +// If CYW43_WL_GPIO_VBUS_PIN is defined then a CYW43 GPIO has to be used to read VBUS. +// This can be passed to cyw43_arch_gpio_get to determine if the device is battery powered. +// PICO_VBUS_PIN and CYW43_WL_GPIO_VBUS_PIN should not both be defined. +#ifndef CYW43_WL_GPIO_VBUS_PIN +#define CYW43_WL_GPIO_VBUS_PIN 2 +#endif + +// If CYW43_USES_VSYS_PIN is defined then CYW43 uses the VSYS GPIO (defined by PICO_VSYS_PIN) for other purposes. +// If this is the case, to use the VSYS GPIO it's necessary to ensure CYW43 is not using it. +// This can be achieved by wrapping the use of the VSYS GPIO in cyw43_thread_enter / cyw43_thread_exit. +#ifndef CYW43_USES_VSYS_PIN +#define CYW43_USES_VSYS_PIN 1 +#endif + +// The GPIO Pin used to monitor VSYS. Typically you would use this with ADC. +// There is an example in adc/read_vsys in pico-examples. +#ifndef PICO_VSYS_PIN +#define PICO_VSYS_PIN 29 +#endif #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif -// no PICO_VBUS_PIN -// no PICO_VSYS_PIN +// PICO_CONFIG: CYW43_PIN_WL_DYNAMIC, flag to indicate if cyw43 SPI pins can be changed at runtime, type=bool, default=false, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_PIN_WL_DYNAMIC +#define CYW43_PIN_WL_DYNAMIC 1 +#endif -#endif \ No newline at end of file +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_REG_ON, gpio pin to power up the cyw43 chip, type=int, default=23, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_REG_ON +#define CYW43_DEFAULT_PIN_WL_REG_ON 23u +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_OUT, gpio pin for spi data out to the cyw43 chip, type=int, default=24, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_DATA_OUT +#define CYW43_DEFAULT_PIN_WL_DATA_OUT 24u +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_IN, gpio pin for spi data in from the cyw43 chip, type=int, default=24, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_DATA_IN +#define CYW43_DEFAULT_PIN_WL_DATA_IN 24u +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_HOST_WAKE, gpio (irq) pin for the irq line from the cyw43 chip, type=int, default=24, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_HOST_WAKE +#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 24u +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CLOCK, gpio pin for the spi clock line to the cyw43 chip, type=int, default=29, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_CLOCK +#define CYW43_DEFAULT_PIN_WL_CLOCK 29u +#endif + +// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CS, gpio pin for the spi chip select to the cyw43 chip, type=int, default=25, advanced=true, group=pico_cyw43_driver +#ifndef CYW43_DEFAULT_PIN_WL_CS +#define CYW43_DEFAULT_PIN_WL_CS 25u +#endif + +#endif diff --git a/micropython/board/PIMORONI_PLASMA2350/pins.csv b/micropython/board/PIMORONI_PLASMA2350/pins.csv index a300583..ca53790 100644 --- a/micropython/board/PIMORONI_PLASMA2350/pins.csv +++ b/micropython/board/PIMORONI_PLASMA2350/pins.csv @@ -30,7 +30,4 @@ LED,GPIO17 LED_R,GPIO16 LED_G,GPIO17 LED_B,GPIO18 -USER_SW,GPIO22 -WL_GPIO0,EXT_GPIO0 -WL_GPIO1,EXT_GPIO1 -WL_GPIO2,EXT_GPIO2 \ No newline at end of file +USER_SW,GPIO22 \ No newline at end of file