From 0f9e3eed01aef6b4b39fc4b8b07fbc1940698ee6 Mon Sep 17 00:00:00 2001 From: Pierre Constantineau Date: Tue, 26 Oct 2021 21:48:11 -0600 Subject: [PATCH 1/6] initial commit for Seeed Review --- .../boards/seeeduino_xiao_rp2040/board.c | 40 ++++++++++++++++ .../seeeduino_xiao_rp2040/mpconfigboard.h | 15 ++++++ .../seeeduino_xiao_rp2040/mpconfigboard.mk | 9 ++++ .../pico-sdk-configboard.h | 4 ++ .../boards/seeeduino_xiao_rp2040/pins.c | 46 +++++++++++++++++++ 5 files changed, 114 insertions(+) create mode 100644 ports/raspberrypi/boards/seeeduino_xiao_rp2040/board.c create mode 100644 ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/seeeduino_xiao_rp2040/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/seeeduino_xiao_rp2040/pins.c diff --git a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/board.c b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/board.c new file mode 100644 index 000000000000..de6e424ed92b --- /dev/null +++ b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/board.c @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.h new file mode 100644 index 000000000000..a0ea3c51a030 --- /dev/null +++ b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.h @@ -0,0 +1,15 @@ +#define MICROPY_HW_BOARD_NAME "Seeeduino XIAO RP2040" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO12) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO11) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO7) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO6) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO2) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO3) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO4) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk new file mode 100644 index 000000000000..6376bd94f1ec --- /dev/null +++ b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x2886 +USB_PID = 0x003f +USB_PRODUCT = "Seeeduino XIAO RP2040" +USB_MANUFACTURER = "Seeed" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "GD25Q16C" diff --git a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/pico-sdk-configboard.h b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/pico-sdk-configboard.h new file mode 100644 index 000000000000..a41131dd22b7 --- /dev/null +++ b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/pins.c b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/pins.c new file mode 100644 index 000000000000..dca7161ba29e --- /dev/null +++ b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/pins.c @@ -0,0 +1,46 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO29) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From c9f834f3a17c4ae89edf00a51738c895ac447325 Mon Sep 17 00:00:00 2001 From: Pierre Constantineau Date: Tue, 26 Oct 2021 21:55:38 -0600 Subject: [PATCH 2/6] added LEDs --- ports/raspberrypi/boards/seeeduino_xiao_rp2040/pins.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/pins.c b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/pins.c index dca7161ba29e..8c8ed1197ce7 100644 --- a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/pins.c +++ b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/pins.c @@ -36,6 +36,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_TX_LED), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_RX_LED), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_YELLOW_LED), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO11) }, From ceeec6f1a0f096ebeef0d2e6e730fe6f4b18038e Mon Sep 17 00:00:00 2001 From: Pierre Constantineau Date: Wed, 27 Oct 2021 08:10:47 -0600 Subject: [PATCH 3/6] updated USB PID to match one received from MengDu from Seeed --- ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk index 6376bd94f1ec..f9a003a52d50 100644 --- a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk +++ b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x2886 -USB_PID = 0x003f +USB_PID = 0x0042 USB_PRODUCT = "Seeeduino XIAO RP2040" USB_MANUFACTURER = "Seeed" From a75473af968b06f9fa18eb5623acc4208f6f1b68 Mon Sep 17 00:00:00 2001 From: Pierre Constantineau Date: Tue, 2 Nov 2021 20:52:58 -0600 Subject: [PATCH 4/6] update to EXTERNAL_FLASH_DEVICES to Puya P25Q16H --- ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk index f9a003a52d50..1540642cd541 100644 --- a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk +++ b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/mpconfigboard.mk @@ -6,4 +6,4 @@ USB_MANUFACTURER = "Seeed" CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 -EXTERNAL_FLASH_DEVICES = "GD25Q16C" +EXTERNAL_FLASH_DEVICES = "P25Q16H" From 2e12956c408ec3f6cc4ed6f19207a9ee5b1a1a4e Mon Sep 17 00:00:00 2001 From: Pierre Constantineau Date: Tue, 2 Nov 2021 23:07:00 -0600 Subject: [PATCH 5/6] updated nvm.toml module --- data/nvm.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/nvm.toml b/data/nvm.toml index e5b149599d14..73cedb354748 160000 --- a/data/nvm.toml +++ b/data/nvm.toml @@ -1 +1 @@ -Subproject commit e5b149599d14a8841167fe552846ca36925b87a0 +Subproject commit 73cedb3547481c15405ab5a88e2b39392ff13e78 From c6051719f56b0cb798882dee16ec327cd09ad1f2 Mon Sep 17 00:00:00 2001 From: Pierre Constantineau Date: Thu, 4 Nov 2021 08:56:14 -0600 Subject: [PATCH 6/6] update nvm.toml module to latest --- data/nvm.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/nvm.toml b/data/nvm.toml index 73cedb354748..266ea20ed801 160000 --- a/data/nvm.toml +++ b/data/nvm.toml @@ -1 +1 @@ -Subproject commit 73cedb3547481c15405ab5a88e2b39392ff13e78 +Subproject commit 266ea20ed80104c315dcb124b482fa5f9f48cdec