From c51081c604f0dd0747d592d3d4952aac890f2c68 Mon Sep 17 00:00:00 2001 From: Paul Grayson Date: Wed, 11 Oct 2023 11:28:47 -0700 Subject: [PATCH] rp2/boards: Add support for Pololu 3pi+ and Zumo robots. Signed-off-by: Paul Grayson --- .../boards/POLOLU_3PI_2040_ROBOT/board.json | 22 +++++++++++++ .../POLOLU_3PI_2040_ROBOT/mpconfigboard.cmake | 1 + .../POLOLU_3PI_2040_ROBOT/mpconfigboard.h | 18 +++++++++++ .../rp2/boards/POLOLU_3PI_2040_ROBOT/pins.csv | 31 +++++++++++++++++++ .../boards/POLOLU_ZUMO_2040_ROBOT/board.json | 23 ++++++++++++++ .../mpconfigboard.cmake | 5 +++ .../POLOLU_ZUMO_2040_ROBOT/mpconfigboard.h | 18 +++++++++++ .../boards/POLOLU_ZUMO_2040_ROBOT/pins.csv | 31 +++++++++++++++++++ .../pololu_zumo_2040_robot.h | 26 ++++++++++++++++ 9 files changed, 175 insertions(+) create mode 100644 ports/rp2/boards/POLOLU_3PI_2040_ROBOT/board.json create mode 100644 ports/rp2/boards/POLOLU_3PI_2040_ROBOT/mpconfigboard.cmake create mode 100644 ports/rp2/boards/POLOLU_3PI_2040_ROBOT/mpconfigboard.h create mode 100644 ports/rp2/boards/POLOLU_3PI_2040_ROBOT/pins.csv create mode 100644 ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/board.json create mode 100644 ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/mpconfigboard.cmake create mode 100644 ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/mpconfigboard.h create mode 100644 ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/pins.csv create mode 100644 ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/pololu_zumo_2040_robot.h diff --git a/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/board.json b/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/board.json new file mode 100644 index 0000000000..5358db627e --- /dev/null +++ b/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/board.json @@ -0,0 +1,22 @@ +{ + "deploy": [ + "../deploy.md" + ], + "docs": "", + "features": [ + "USB-C", + "IMU", + "RGB LED", + "Display", + "Dual-core", + "External Flash" + ], + "images": [ + "pololu_3pi_2040_robot.jpg" + ], + "mcu": "rp2040", + "product": "Pololu 3pi+ 2040 Robot", + "thumbnail": "", + "url": "https://www.pololu.com/3pi", + "vendor": "Pololu" +} diff --git a/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/mpconfigboard.cmake b/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/mpconfigboard.cmake new file mode 100644 index 0000000000..79273343d5 --- /dev/null +++ b/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/mpconfigboard.cmake @@ -0,0 +1 @@ +# cmake file for Pololu 3pi+ 2040 Robot diff --git a/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/mpconfigboard.h b/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/mpconfigboard.h new file mode 100644 index 0000000000..917f828e58 --- /dev/null +++ b/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/mpconfigboard.h @@ -0,0 +1,18 @@ +#pragma once + +// Board and hardware specific configuration +#define MICROPY_HW_BOARD_NAME "Pololu 3pi+ 2040 Robot" +#define MICROPY_HW_FLASH_STORAGE_BYTES (15 * 1024 * 1024) + +#define MICROPY_HW_USB_MSC (1) +#define MICROPY_HW_USB_VID (0x1FFB) +#define MICROPY_HW_USB_PID (0x2043) +#define MICROPY_HW_USB_DESC_STR_MAX (40) +#define MICROPY_HW_USB_MANUFACTURER_STRING "Pololu Corporation" +#define MICROPY_HW_USB_PRODUCT_FS_STRING MICROPY_HW_BOARD_NAME " MicroPython" + +#define MICROPY_BANNER_MACHINE MICROPY_HW_BOARD_NAME + +#define MICROPY_HW_I2C_NO_DEFAULT_PINS (1) +#define MICROPY_HW_SPI_NO_DEFAULT_PINS (1) +#define MICROPY_HW_UART_NO_DEFAULT_PINS (1) diff --git a/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/pins.csv b/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/pins.csv new file mode 100644 index 0000000000..11dc5ec8e4 --- /dev/null +++ b/ports/rp2/boards/POLOLU_3PI_2040_ROBOT/pins.csv @@ -0,0 +1,31 @@ +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 +GP23,GPIO23 +GP24,GPIO24 +GP25,GPIO25 +GP26,GPIO26 +GP27,GPIO27 +GP28,GPIO28 +GP29,GPIO29 +LED,GPIO25 diff --git a/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/board.json b/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/board.json new file mode 100644 index 0000000000..7ef383a9c4 --- /dev/null +++ b/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/board.json @@ -0,0 +1,23 @@ +{ + "deploy": [ + "../deploy.md" + ], + "docs": "", + "features": [ + "USB-C", + "JST-SH", + "IMU", + "RGB LED", + "Display", + "Dual-core", + "External Flash" + ], + "images": [ + "pololu_zumo_2040_robot.jpg" + ], + "mcu": "rp2040", + "product": "Pololu Zumo 2040 Robot", + "thumbnail": "", + "url": "https://www.pololu.com/zumo", + "vendor": "Pololu" +} diff --git a/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/mpconfigboard.cmake b/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/mpconfigboard.cmake new file mode 100644 index 0000000000..4ed9173207 --- /dev/null +++ b/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/mpconfigboard.cmake @@ -0,0 +1,5 @@ +# cmake file for Pololu Zumo 2040 Robot + +# This board is not yet in upstream pico-sdk, so define it here +# See also: https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards +list(APPEND PICO_BOARD_HEADER_DIRS ${MICROPY_BOARD_DIR}) diff --git a/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/mpconfigboard.h b/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/mpconfigboard.h new file mode 100644 index 0000000000..c910014622 --- /dev/null +++ b/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/mpconfigboard.h @@ -0,0 +1,18 @@ +#pragma once + +// Board and hardware specific configuration +#define MICROPY_HW_BOARD_NAME "Pololu Zumo 2040 Robot" +#define MICROPY_HW_FLASH_STORAGE_BYTES (15 * 1024 * 1024) + +#define MICROPY_HW_USB_MSC (1) +#define MICROPY_HW_USB_VID (0x1FFB) +#define MICROPY_HW_USB_PID (0x2044) +#define MICROPY_HW_USB_DESC_STR_MAX (40) +#define MICROPY_HW_USB_MANUFACTURER_STRING "Pololu Corporation" +#define MICROPY_HW_USB_PRODUCT_FS_STRING MICROPY_HW_BOARD_NAME " MicroPython" + +#define MICROPY_BANNER_MACHINE MICROPY_HW_BOARD_NAME + +#define MICROPY_HW_I2C_NO_DEFAULT_PINS (1) +#define MICROPY_HW_SPI_NO_DEFAULT_PINS (1) +#define MICROPY_HW_UART_NO_DEFAULT_PINS (1) diff --git a/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/pins.csv b/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/pins.csv new file mode 100644 index 0000000000..11dc5ec8e4 --- /dev/null +++ b/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/pins.csv @@ -0,0 +1,31 @@ +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 +GP23,GPIO23 +GP24,GPIO24 +GP25,GPIO25 +GP26,GPIO26 +GP27,GPIO27 +GP28,GPIO28 +GP29,GPIO29 +LED,GPIO25 diff --git a/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/pololu_zumo_2040_robot.h b/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/pololu_zumo_2040_robot.h new file mode 100644 index 0000000000..252cea981b --- /dev/null +++ b/ports/rp2/boards/POLOLU_ZUMO_2040_ROBOT/pololu_zumo_2040_robot.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2023 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 +// ----------------------------------------------------- + +#ifndef _POLOLU_ZUMO_2040_ROBOT_H +#define _POLOLU_ZUMO_2040_ROBOT_H + +// For board detection +#define POLOLU_ZUMO_2040_ROBOT + +#define PICO_DEFAULT_LED_PIN 25 +#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1 +#define PICO_FLASH_SPI_CLKDIV 2 +#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) + +// All boards have at least the B1 revision +#define PICO_RP2040_B0_SUPPORTED 0 + +#endif