From f31d1468cdffa12fc0dbf8068f9669a91d26a885 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Thu, 21 Nov 2024 17:25:35 +0000 Subject: [PATCH] CI: i75w build. Note: 4MB build only. --- .github/workflows/micropython.yml | 2 + .../board/PIMORONI_I75W_2350/manifest.py | 10 ++ .../PIMORONI_I75W_2350/mpconfigboard.cmake | 38 +++++ .../board/PIMORONI_I75W_2350/mpconfigboard.h | 26 +++ .../PIMORONI_I75W_2350/pimoroni_i75w_2350.h | 151 ++++++++++++++++++ micropython/board/PIMORONI_I75W_2350/pins.csv | 30 ++++ 6 files changed, 257 insertions(+) create mode 100644 micropython/board/PIMORONI_I75W_2350/manifest.py create mode 100644 micropython/board/PIMORONI_I75W_2350/mpconfigboard.cmake create mode 100644 micropython/board/PIMORONI_I75W_2350/mpconfigboard.h create mode 100644 micropython/board/PIMORONI_I75W_2350/pimoroni_i75w_2350.h create mode 100644 micropython/board/PIMORONI_I75W_2350/pins.csv diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index e59a050..27ce61b 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -31,6 +31,8 @@ jobs: board: PIMORONI_TINY2350 - name: pico_plus2_rp2350 board: PIMORONI_PICO_PLUS2 + - name: i75w_rp2350 + board: PIMORONI_I75W_2350 env: # MicroPython version will be contained in github.event.release.tag_name for releases diff --git a/micropython/board/PIMORONI_I75W_2350/manifest.py b/micropython/board/PIMORONI_I75W_2350/manifest.py new file mode 100644 index 0000000..ab6e69e --- /dev/null +++ b/micropython/board/PIMORONI_I75W_2350/manifest.py @@ -0,0 +1,10 @@ +require("bundle-networking") + +# Bluetooth +require("aioble") + +include("$(PORT_DIR)/boards/manifest.py") + +include("../manifest_pico2.py") + +freeze("$(BOARD_DIR)/../../modules_py", "lte.py") \ No newline at end of file diff --git a/micropython/board/PIMORONI_I75W_2350/mpconfigboard.cmake b/micropython/board/PIMORONI_I75W_2350/mpconfigboard.cmake new file mode 100644 index 0000000..aff627e --- /dev/null +++ b/micropython/board/PIMORONI_I75W_2350/mpconfigboard.cmake @@ -0,0 +1,38 @@ +# cmake file for Raspberry Pi Pico +set(PICO_BOARD "pimoroni_i75w_2350") +set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}) +set(PICO_PLATFORM "rp2350") + +# Board specific version of the frozen manifest +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_I75W_2350/mpconfigboard.h b/micropython/board/PIMORONI_I75W_2350/mpconfigboard.h new file mode 100644 index 0000000..b36e241 --- /dev/null +++ b/micropython/board/PIMORONI_I75W_2350/mpconfigboard.h @@ -0,0 +1,26 @@ +// Board and hardware specific configuration +#define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - (2 * 1024 * 1024)) + +// Set up networking. +#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "I75W" + +#define MICROPY_HW_BOARD_NAME "Pimoroni i75w RP2350" + +// Enable WiFi & PPP +#define MICROPY_PY_NETWORK (1) +#define MICROPY_PY_NETWORK_PPP_LWIP (1) + +// CYW43 driver configuration. +#define CYW43_USE_SPI (1) +#define CYW43_LWIP (1) +#define CYW43_GPIO (1) +#define CYW43_SPI_PIO (1) + +#ifndef CYW43_WL_GPIO_COUNT +#define CYW43_WL_GPIO_COUNT 3 +#endif + +#define MICROPY_HW_PIN_EXT_COUNT CYW43_WL_GPIO_COUNT + +int mp_hal_is_pin_reserved(int n); +#define MICROPY_HW_PIN_RESERVED(i) mp_hal_is_pin_reserved(i) diff --git a/micropython/board/PIMORONI_I75W_2350/pimoroni_i75w_2350.h b/micropython/board/PIMORONI_I75W_2350/pimoroni_i75w_2350.h new file mode 100644 index 0000000..51a9292 --- /dev/null +++ b/micropython/board/PIMORONI_I75W_2350/pimoroni_i75w_2350.h @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2024 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/pico2_w.h" + +// pico_cmake_set PICO_PLATFORM=rp2350 +// pico_cmake_set PICO_CYW43_SUPPORTED = 1 + +#ifndef _BOARDS_PICO2_W_H +#define _BOARDS_PICO2_W_H + +// For board detection +#define RASPBERRYPI_PICO2_W + +// --- RP2350 VARIANT --- +//#define PICO_RP2350A 1 + +// --- UART --- +#ifndef PICO_DEFAULT_UART +#define PICO_DEFAULT_UART 0 +#endif +#ifndef PICO_DEFAULT_UART_TX_PIN +#define PICO_DEFAULT_UART_TX_PIN 0 +#endif +#ifndef PICO_DEFAULT_UART_RX_PIN +#define PICO_DEFAULT_UART_RX_PIN 1 +#endif + +// --- LED --- +// no PICO_DEFAULT_LED_PIN - LED is on Wireless chip +// no PICO_DEFAULT_WS2812_PIN + +// --- I2C --- +#ifndef PICO_DEFAULT_I2C +#define PICO_DEFAULT_I2C 0 +#endif +#ifndef PICO_DEFAULT_I2C_SDA_PIN +#define PICO_DEFAULT_I2C_SDA_PIN 4 +#endif +#ifndef PICO_DEFAULT_I2C_SCL_PIN +#define PICO_DEFAULT_I2C_SCL_PIN 5 +#endif + +// --- SPI --- +#ifndef PICO_DEFAULT_SPI +#define PICO_DEFAULT_SPI 0 +#endif +#ifndef PICO_DEFAULT_SPI_SCK_PIN +#define PICO_DEFAULT_SPI_SCK_PIN 18 +#endif +#ifndef PICO_DEFAULT_SPI_TX_PIN +#define PICO_DEFAULT_SPI_TX_PIN 19 +#endif +#ifndef PICO_DEFAULT_SPI_RX_PIN +#define PICO_DEFAULT_SPI_RX_PIN 16 +#endif +#ifndef PICO_DEFAULT_SPI_CSN_PIN +#define PICO_DEFAULT_SPI_CSN_PIN 17 +#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 +// 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 + +// 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 0 +#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_I75W_2350/pins.csv b/micropython/board/PIMORONI_I75W_2350/pins.csv new file mode 100644 index 0000000..caec449 --- /dev/null +++ b/micropython/board/PIMORONI_I75W_2350/pins.csv @@ -0,0 +1,30 @@ +GP0,GPIO0 +GP1,GPIO1 +GP2,GPIO2 +GP3,GPIO3 +GP4,GPIO4 +GP5,GPIO5 +GP6,GPIO6 +GP7,GPIO7 +GP8,GPIO8 +GP9,GPIO9 +GP10,GPIO10 +GP11,GPIO11 +GP12,GPIO12 +GP13,GPIO13 +GP14,GPIO14 +GP15,GPIO15 +GP16,GPIO16 +GP17,GPIO17 +GP18,GPIO18 +GP19,GPIO19 +GP20,GPIO20 +GP21,GPIO21 +GP22,GPIO22 +GP25,GPIO25 +GP26,GPIO26 +GP27,GPIO27 +GP28,GPIO28 +WL_GPIO0,EXT_GPIO0 +WL_GPIO1,EXT_GPIO1 +WL_GPIO2,EXT_GPIO2 \ No newline at end of file