diff --git a/ports/rp2/boards/VCC_GND_RP2040/README.md b/ports/rp2/boards/VCC_GND_RP2040/README.md new file mode 100644 index 0000000000000..6437e28d3c454 --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/README.md @@ -0,0 +1,34 @@ +# VCC-GND Studio YD-RP2040 + +The VCC-GND Studio YD-RP2040 Board is based on the Raspberry Pi RP2040 and can be +purchased with 4/8/16 MiB of flash. + +These boards are available from a number of resellers and often have the name +"YD-RP2040". initdc maintain the [YD-RP2040](https://github.com/initdc/YD-RP2040/tree/master) +repository containing information on the board. + +## Build notes + +Builds can be configured with the `BOARD_VARIANT` parameter. Valid variants +can be displayed with the `query-variant` target. An example: + +```bash +> cd ports/rp2 +> make BOARD=VCC_GND_RP2040 query-variants +VARIANTS: flash_4mb flash_8mb flash_16mb +> make BOARD=VCC_GND_RP2040 BOARD_VARIANT=flash_8mb submodules all # Build the 8 MiB variant +``` + +`flash_4mb` is the default if `BOARD_VARIANT` is not supplied. + +## Board-specific modules + +The `board` module contains definitions for the onboard LED, onboard WS2812B and user button. + +Example: + +```python +> import board +> board.led.toggle() # Toggles the state of the on-board LED +> board.key.value() # Returns 0 or 1 corresponding to the state of the user key +``` diff --git a/ports/rp2/boards/VCC_GND_RP2040/board.json b/ports/rp2/boards/VCC_GND_RP2040/board.json new file mode 100644 index 0000000000000..3b2431e737a38 --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/board.json @@ -0,0 +1,24 @@ +{ + "deploy": [ + "deploy.md" + ], + "docs": "", + "features": [ + "Breadboard Friendly", + "SPI Flash", + "USB-C", + "WS2812B" + ], + "images": [ + "YD-RP2040.jpg" + ], + "mcu": "rp2040", + "product": "YD-RP2040", + "url": "http://vcc-gnd.com/", + "variants": { + "flash_4mb": "4 MiB Flash", + "flash_8mb": "8 MiB Flash", + "flash_16mb": "16 MiB Flash" + }, + "vendor": "VCC-GND Studio" +} diff --git a/ports/rp2/boards/VCC_GND_RP2040/deploy.md b/ports/rp2/boards/VCC_GND_RP2040/deploy.md new file mode 100644 index 0000000000000..b4db7675ebb5f --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/deploy.md @@ -0,0 +1,8 @@ +### Flashing via UF2 bootloader + +To get the board in bootloader mode ready for the firmware update, execute +`machine.bootloader()` at the MicroPython REPL. Alternatively, hold +down the BOOTSEL button while pressing reset (NRST). The uf2 file below +should then be copied to the USB mass storage device that appears. Once +programming of the new firmware is complete the device will automatically reset +and be ready for use. diff --git a/ports/rp2/boards/VCC_GND_RP2040/manifest.py b/ports/rp2/boards/VCC_GND_RP2040/manifest.py new file mode 100644 index 0000000000000..f993d4fa6bd29 --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/manifest.py @@ -0,0 +1,2 @@ +include("$(PORT_DIR)/boards/manifest.py") +freeze("./modules") diff --git a/ports/rp2/boards/VCC_GND_RP2040/modules/board.py b/ports/rp2/boards/VCC_GND_RP2040/modules/board.py new file mode 100644 index 0000000000000..4576e95d50d31 --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/modules/board.py @@ -0,0 +1,4 @@ +from machine import Pin + +led = Pin(25, Pin.OUT) +key = Pin(24, Pin.IN, Pin.PULL_UP) diff --git a/ports/rp2/boards/VCC_GND_RP2040/mpconfigboard.cmake b/ports/rp2/boards/VCC_GND_RP2040/mpconfigboard.cmake new file mode 100644 index 0000000000000..c56c2c40c7e90 --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/mpconfigboard.cmake @@ -0,0 +1,22 @@ +# CMake file for VCC-GND Studio YD-RP2040 boards + +# The VCC-GND Studio boards don't have official pico-sdk support so we define it +# See also: https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards +list(APPEND PICO_BOARD_HEADER_DIRS ${MICROPY_BOARD_DIR}) + +# Freeze board.py +set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) + +# Provide different variants for the downloads page +set(BOARD_VARIANTS "flash_4mb flash_8mb flash_16mb") + +# Select the 4MB variant as the default +set(PICO_BOARD "vccgndstudio_4mb") + +if("${BOARD_VARIANT}" STREQUAL "flash_8mb") +set(PICO_BOARD "vccgndstudio_8mb") +endif() + +if("${BOARD_VARIANT}" STREQUAL "flash_16mb") +set(PICO_BOARD "vccgndstudio_16mb") +endif() \ No newline at end of file diff --git a/ports/rp2/boards/VCC_GND_RP2040/mpconfigboard.h b/ports/rp2/boards/VCC_GND_RP2040/mpconfigboard.h new file mode 100644 index 0000000000000..5944f204fa8ff --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/mpconfigboard.h @@ -0,0 +1,7 @@ +#define MICROPY_HW_BOARD_NAME "VCC-GND Studio YD-RP2040" + +// Allow 1MB for the firmware image itself, allocate the remainder to the filesystem +#define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - (1 * 1024 * 1024)) + +// https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/boards/vcc_gnd_yd_rp2040/mpconfigboard.h#L4 +#define MICROPY_HW_NEOPIXEL (&pin_GPIO23) diff --git a/ports/rp2/boards/VCC_GND_RP2040/pins.csv b/ports/rp2/boards/VCC_GND_RP2040/pins.csv new file mode 100644 index 0000000000000..410a7f2e6ee29 --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/pins.csv @@ -0,0 +1,4 @@ +RGB,GPIO23 +NEOPIXEL,GPIO23 +BUTTON,GPIO24 +LED,GPIO25 diff --git a/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_16mb.h b/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_16mb.h new file mode 100644 index 0000000000000..5671a327ea2a7 --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_16mb.h @@ -0,0 +1,18 @@ +// A pico-sdk board definition is required since the WeAct Studio boards are +// not officially supported. +// +// Officially supported boards: +// https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards + +#ifndef _BOARDS_VCCGNDSTUDIO_16MB_H +#define _BOARDS_VCCGNDSTUDIO_16MB_H + +#include "vccgndstudio_common.h" + +#define VCCGNDSTUDIO_16MB + +#ifndef PICO_FLASH_SIZE_BYTES +#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) +#endif + +#endif diff --git a/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_4mb.h b/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_4mb.h new file mode 100644 index 0000000000000..060f8d602dced --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_4mb.h @@ -0,0 +1,18 @@ +// A pico-sdk board definition is required since the WeAct Studio boards are +// not officially supported. +// +// Officially supported boards: +// https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards + +#ifndef _BOARDS_VCCGNDSTUDIO_4MB_H +#define _BOARDS_VCCGNDSTUDIO_4MB_H + +#include "vccgndstudio_common.h" + +#define VCCGNDSTUDIO_4MB + +#ifndef PICO_FLASH_SIZE_BYTES +#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) +#endif + +#endif diff --git a/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_8mb.h b/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_8mb.h new file mode 100644 index 0000000000000..bdf207059b441 --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_8mb.h @@ -0,0 +1,18 @@ +// A pico-sdk board definition is required since the WeAct Studio boards are +// not officially supported. +// +// Officially supported boards: +// https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards + +#ifndef _BOARDS_VCCGNDSTUDIO_8MB_H +#define _BOARDS_VCCGNDSTUDIO_8MB_H + +#include "vccgndstudio_common.h" + +#define VCCGNDSTUDIO_8MB + +#ifndef PICO_FLASH_SIZE_BYTES +#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024) +#endif + +#endif diff --git a/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_common.h b/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_common.h new file mode 100644 index 0000000000000..d8e602da0a694 --- /dev/null +++ b/ports/rp2/boards/VCC_GND_RP2040/vccgndstudio_common.h @@ -0,0 +1,62 @@ +// Common configuration to all WeAct Studio boards (only flash size differs) + +#ifndef _BOARDS_VCCGNDSTUDIO_COMMON_H +#define _BOARDS_VCCGNDSTUDIO_COMMON_H + +// --- 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 --- +#ifndef PICO_DEFAULT_LED_PIN +#define PICO_DEFAULT_LED_PIN 25 +#endif + +// --- 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 + +// All boards have B1 RP2040 +#ifndef PICO_RP2040_B0_SUPPORTED +#define PICO_RP2040_B0_SUPPORTED 0 +#endif + +#endif
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: