Building my own board from Adafruit RP2040

Hi,

I am looking into designing my own board but referencing the Adafruit Feather RP2040 design for starting. So far, I have the Adafruit board working w/platformio in vscode. I am using the earlephilhower platform (link) and was wondering if this platform will be able to support my own design since I am basing it off the Adafruit design?

Do I keep the same board name in my ini file for my own design? Right now, my board is the adafruit_feather because I am testing the Adafruit Feather RP2040, but later down the road it will be my board which does not have a name yet.

[env]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
framework = arduino
monitor_speed = 115200
board_build.core = earlephilhower
board_build.filesystem_size = 0.5m

[env:adafruit_feather]
board = adafruit_feather

Sure, why not. People add boards to the EarlePhilhower core all the time. All board definitions are conveniently auto generated, so you basically PR your change in that script plus the variant files that define the pins for your board.

https://github.com/earlephilhower/arduino-pico/pull/1828 is a good PR to look at.

If you don’t yet have custom hardware though, try to stick with the boards that are already there.

This question also largely overlaps what has already been asked at https://community.platformio.org/t/rp2040-custom-board-in-maxgerhardt-platform-raspberrypi/35845.

1 Like

Thanks for your feedback and the resources you’ve provided. I will look into this.

I do have a question about defining the pins on my board. For example, the datasheet for the RP2040 shows that all 30 of the pins can be connected to either SPI0 (SCK, TX, RX) or SPI1 (SCK, TX, RX). Are one of the files that needs to be included in the EarlePhilhower core supposed to configure the RP2040 to recognize that I want specific pin numbers as SPI pins?

The defines

// SPI
#define PIN_SPI0_MISO  (16u)
#define PIN_SPI0_MOSI  (19u)
#define PIN_SPI0_SCK   (18u)
#define PIN_SPI0_SS    (17u)

#define PIN_SPI1_MISO  (12u)
#define PIN_SPI1_MOSI  (15u)
#define PIN_SPI1_SCK   (14u)
#define PIN_SPI1_SS    (13u)

in pins_arduino.h for the board are default values for the creation of the SPI and SPI1 object. The user can still call SPI.setTX() etc to change these to another pin that supports that function. These functions accept any valid pin that supports that function.

If the board does have on-board SPI devices, it would be useful to set the default SPI pins as such. Otherwise, it doesn’t matter much.