diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 894a4a3..eb043ff 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -20,6 +20,7 @@ jobs: - name: pimoroni_plasma2350 - name: pimoroni_tiny2350 - name: pimoroni_pico_plus2 + - name: pimoroni_pico_lipo2 env: # MicroPython version will be contained in github.event.release.tag_name for releases @@ -99,4 +100,4 @@ jobs: if: github.event_name == 'release' uses: softprops/action-gh-release@v2 with: - files: ${{ env.CI_BUILD_ROOT }}/${{ env.CI_RELEASE_FILENAME }}-with-filesystem.uf2 \ No newline at end of file + files: ${{ env.CI_BUILD_ROOT }}/${{ env.CI_RELEASE_FILENAME }}-with-filesystem.uf2 diff --git a/boards/pimoroni_pico_lipo2/manifest.py b/boards/pimoroni_pico_lipo2/manifest.py new file mode 100644 index 0000000..77dc9fd --- /dev/null +++ b/boards/pimoroni_pico_lipo2/manifest.py @@ -0,0 +1,8 @@ +include("$(PORT_DIR)/boards/manifest.py") + +require("bundle-networking") + +# Bluetooth +require("aioble") + +include("../manifest_pico2.py") \ No newline at end of file diff --git a/boards/pimoroni_pico_lipo2/mpconfigboard.cmake b/boards/pimoroni_pico_lipo2/mpconfigboard.cmake new file mode 100644 index 0000000..aa22791 --- /dev/null +++ b/boards/pimoroni_pico_lipo2/mpconfigboard.cmake @@ -0,0 +1,19 @@ +# cmake file for Pimoroni Pico LiPo +set(PICO_BOARD "pimoroni_pico_lipo2") +set(PICO_PLATFORM "rp2350") + +set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR}) + +# To change the gpio count for QFN-80 +set(PICO_NUM_GPIOS 48) + +# Links micropy_lib_lwip and sets MICROPY_PY_LWIP = 1 +# Picked up and expanded upon in mpconfigboard.h +set(MICROPY_PY_LWIP ON) + +include(enable_cyw43.cmake) + +# Board specific version of the frozen manifest +set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) + +include(${CMAKE_CURRENT_LIST_DIR}/../common.cmake) diff --git a/boards/pimoroni_pico_lipo2/mpconfigboard.h b/boards/pimoroni_pico_lipo2/mpconfigboard.h new file mode 100644 index 0000000..fd0cf0a --- /dev/null +++ b/boards/pimoroni_pico_lipo2/mpconfigboard.h @@ -0,0 +1,18 @@ +// Board and hardware specific configuration +#define MICROPY_HW_BOARD_NAME "Pimoroni Pico LiPo 2" +#define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - 1024 * 1024 * 2) + +#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "PicoLiPo2" + +// Enable PPP +#define MICROPY_PY_NETWORK_PPP_LWIP (1) + +#include "enable_cyw43.h" + +#undef MICROPY_HW_PIN_RESERVED +#define MICROPY_HW_PIN_RESERVED(i) (false) + +// PSRAM Settings +#define MICROPY_HW_ENABLE_PSRAM (1) +#define MICROPY_HW_PSRAM_CS_PIN PIMORONI_PICO_LIPO2_PSRAM_CS_PIN +#define MICROPY_GC_SPLIT_HEAP (1) \ No newline at end of file diff --git a/boards/pimoroni_pico_lipo2/pimoroni_pico_lipo2.h b/boards/pimoroni_pico_lipo2/pimoroni_pico_lipo2.h new file mode 100644 index 0000000..8ec3b14 --- /dev/null +++ b/boards/pimoroni_pico_lipo2/pimoroni_pico_lipo2.h @@ -0,0 +1,163 @@ +/* + * 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/pimoroni_pico_lipo2.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 PIMORONI_PICO_LIPO2_RP2350 + +// --- BOARD SPECIFIC --- +#define SPICE_SPI 0 +#define SPICE_TX_MISO_PIN 32 +#define SPICE_RX_CS_PIN 33 +#define SPICE_NETLIGHT_SCK_PIN 34 +#define SPICE_RESET_MOSI_PIN 35 +#define SPICE_PWRKEY_BL_PIN 36 + +#define PIMORONI_PICO_LIPO2_USER_SW_PIN 45 +#define PIMORONI_PICO_LIPO2_PSRAM_CS_PIN 47 + +// --- RP2350 VARIANT --- +// not PICO_RP2350A + +// --- UART --- +#ifndef PICO_DEFAULT_UART +#define PICO_DEFAULT_UART 0 +#endif +#ifndef PICO_DEFAULT_UART_TX_PIN +#define PICO_DEFAULT_UART_TX_PIN SPICE_TX_MISO_PIN +#endif +#ifndef PICO_DEFAULT_UART_RX_PIN +#define PICO_DEFAULT_UART_RX_PIN SPICE_RX_CS_PIN +#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 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 +// 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 +// no 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 +// no 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 +// no CYW43_USES_VSYS_PIN +#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 +// no PICO_VSYS_PIN +#endif + +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 +#ifndef PICO_RP2350_A2_SUPPORTED +#define PICO_RP2350_A2_SUPPORTED 1 +#endif + +// cyw43 SPI pins can't be changed at runtime +#ifndef CYW43_PIN_WL_DYNAMIC +#define CYW43_PIN_WL_DYNAMIC 0 +#endif + +// gpio pin to power up the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_REG_ON +#define CYW43_DEFAULT_PIN_WL_REG_ON SPICE_TX_MISO_PIN +#endif + +// gpio pin for spi data out to the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_DATA_OUT +#define CYW43_DEFAULT_PIN_WL_DATA_OUT SPICE_RESET_MOSI_PIN +#endif + +// gpio pin for spi data in from the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_DATA_IN +#define CYW43_DEFAULT_PIN_WL_DATA_IN SPICE_RESET_MOSI_PIN +#endif + +// gpio (irq) pin for the irq line from the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_HOST_WAKE +#define CYW43_DEFAULT_PIN_WL_HOST_WAKE SPICE_RESET_MOSI_PIN +#endif + +// gpio pin for the spi clock line to the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_CLOCK +#define CYW43_DEFAULT_PIN_WL_CLOCK SPICE_NETLIGHT_SCK_PIN +#endif + +// gpio pin for the spi chip select to the cyw43 chip +#ifndef CYW43_DEFAULT_PIN_WL_CS +#define CYW43_DEFAULT_PIN_WL_CS SPICE_RX_CS_PIN +#endif + +#endif \ No newline at end of file diff --git a/boards/pimoroni_pico_lipo2/pins.csv b/boards/pimoroni_pico_lipo2/pins.csv new file mode 100644 index 0000000..77bae9e --- /dev/null +++ b/boards/pimoroni_pico_lipo2/pins.csv @@ -0,0 +1,57 @@ +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 +GP29,GPIO29 +GP30,GPIO30 +GP31,GPIO31 +GP32,GPIO32 +GP33,GPIO33 +GP34,GPIO34 +GP35,GPIO35 +GP36,GPIO36 +GP37,GPIO37 +GP38,GPIO38 +GP39,GPIO39 +GP40,GPIO40 +GP41,GPIO41 +GP42,GPIO42 +GP43,GPIO43 +GP44,GPIO44 +GP45,GPIO45 +GP46,GPIO46 +GP47,GPIO47 +WL_GPIO0,EXT_GPIO0 +WL_GPIO1,EXT_GPIO1 +WL_GPIO2,EXT_GPIO2 +VBAT_SENSE,GPIO24 +LED,GPIO25 +SPICE_TX_MISO,GPIO32 +SPICE_RX_CS,GPIO33 +SPICE_NETLIGHT_SCK,GPIO34 +SPICE_RESET_MOSI,GPIO35 +SPICE_PWRKEY_BL,GPIO36 +PSRAM_CS,GPIO47 \ No newline at end of file diff --git a/boards/pimoroni_pico_lipo2/usermodules.cmake b/boards/pimoroni_pico_lipo2/usermodules.cmake new file mode 100644 index 0000000..d3f340d --- /dev/null +++ b/boards/pimoroni_pico_lipo2/usermodules.cmake @@ -0,0 +1,3 @@ +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../") + +include(usermod-common) \ No newline at end of file