PrettyPins PDF on GitHub.
The Metro RP2040 has two power input options, a power switch, and a few more power pins than your usual Metro/Arduino board.
Power Inputs
You have two power input options:
- USB C port - This is used for both powering and programming the board. You can power it with any USB C cable and will request 5V from a USB C PD.
- DC barrel jack - The DC Jack is a 5.5mm/2.1mm center-positive DC connector, which is the most common available. Provide about 6V-12V here to power the Metro. Great for when you have a wall adapter power supply. Don't use a center-negative adapter, it won't work (the On green LED will not light)
Power Control
- On/Off switch - This switch controls the DC jack power only. If you plug in your board and nothing happens, make sure the switch is flipped to "ON"!
Power Outputs
- 3.3V - This is the output pin from the 3.3V regulator. It can supply up to around 400mA.
- 5V - This is the output pin from the 5V regulator (when DC jack is used), or from USB. It can supply up to around 500mA peak from USB and up to 800mA peak from DC.
- GND - This is the common ground for all power and logic.
- VIN - This is the higher of the DC jack or USB voltage. So if the DC jack is plugged in and 9V, VIN is 9V. If only USB connected, this will be 5V.
I2C and SPI on RP2040
The RP2040 is capable of handling I2C, SPI and UART on many pins. However, there are really only two peripherals each of I2C, SPI and UART: I2C0 and I2C1, SPI0 and SPI1, and UART0 and UART1. So while many pins are capable of I2C, SPI and UART, you can only do two at a time, and only on separate peripherals, 0 and 1. I2C, SPI and UART peripherals are included and numbered below.
PWM on RP2040
The RP2040 supports PWM on all pins. However, it is not capable of PWM on all pins at the same time. There are 8 PWM "slices", each with two outputs, A and B. Each pin on the Feather is assigned a PWM slice and output. For example, A0 is PWM5 A, which means it is first output of the fifth slice. You can have up to 16 PWM objects on the Feather RP2040. The important thing to know is that you cannot use the same slice and output more than once at the same time. So, if you have a PWM object on pin A0, you cannot also put a PWM object on D10, because they are both PWM5 A. The PWM slices and outputs are indicated below. Note that PWM7 A and PWM7 B are not available on the Metro RP2040 because not all pins are broken out.
Analog Pins
The RP2040 has four ADCs. These pins are the only pins capable of handling analog, and they can also do digital.
- A0/GPIO26 - This pin is ADC0. It is also SPI1 SCK, I2C1 SDA and PWM5 A.
- A1/GPIO27 - This pin is ADC1. It is also SPI1 MOSI, I2C1 SCL and PWM5 B.
- A2/GPIO28 - This pin is ADC2. It is also SPI1 MISO, UART0 TX, I2C1 SDA and PWM6 A.
- A3/GPIO29 - This pin is ADC3. It is also SPI1 CS, UART0 RX, I2C0 SCL and PWM6 B.
Digital Pins
These are the digital I/O pins. They all have multiple capabilities.
- D24/GPIO24 - Digital I/O pin 24. It is also UART1 TX, I2C0 SDA, and PWM4 A.
- D25/GPIO25 - Digital I/O pin 25. It is also UART1 RX, I2C0 SCL, and PWM4 B.
- SCL/GPIO17 - This is the main I2C0 SCL. It is also SPI0 CS, UART0 RX, and PWM0 B.
- SDA/GPIO16 - This is the main I2C0 SDA. It is also SPI0 MISO, UART0 TX, and PWM0 A.
- D13/GPIO13 - Digital I/O pin 13. It is also SPI1 CS, UART0 RX, I2C0 SCL and PWM6 B.
- D12/GPIO12 - Digital I/O pin 12. It is also SPI1 MISO, UART0 TX, I2C0 SDA and PWM6 A.
- D11/GPIO11 - Digital I/O pin 11. It is also SPI1 MOSI, I2C1 SCL and PWM5 B.
- D10/GPIO10 - Digital I/O pin 10. It is also SPI1 SCK, I2C1 SDA and PWM5 A.
- D9/GPIO9 - Digital I/O pin 9. It is also SPI1 CS, UART1 RX, I2C0 SCL and PWM4 B.
- D8/GPIO8 - Digital I/O pin 8. It is also SPI1 MISO, UART1 TX, I2C0 SDA, and PWM4 A.
- D7/GPIO7 - Digital I/O pin 7. It is also SPI0 MOSI, I2C1 SCL, and PWM3 B.
- D6/GPIO6 - Digital I/O pin 6. It is also SPI0 SCK, I2C1 SDA, and PWM3 A.
- D5/GPIO5 - Digital I/O pin 5. It is also SPI0 CS, UART1 RX, I2C0 SCL, and PWM2 B.
- D4/GPIO4 - Digital I/O pin 4. It is also SPI0 MISO, UART1 TX, I2C0 SDA and PWM2 A.
- D3/GPIO3 - Digital I/O pin 3. It is also SPI0 MOSI, I2C1 SCL and PWM1 B.
- D2/GPIO2 - Digital I/O pin 2. It is also SPI0 SCK, I2C1 SDA and PWM1 A.
- SCK/SDIO_CLK/GPIO18 - This is the main SPI0 SCK pin. It is also I2C1 SDA, and PWM1 A.
- MOSI/SDIO_CMD/GPIO19 - This is the main SPI0 MOSI pin. It is also I2C1 SCL, and PWM1 B.
- MISO/SDIO_DAT/GPIO20 - This is the main SPI0 MISO pin. It is also UART1 TX, I2C0 SDA, and PWM2 A.
Note these two pins can be swapped with the slide switch next to the header pin location.
- TX/D0/GPIO0 - The main UART0 TX pin. It is also I2C0 SCL, SPI0 MISO and PWM0 A.
- RX/D1/GPIO1 - The main UART0 RX pin. It is also I2C0 SDA, SPI0 CS and PWM0 B.
CircuitPython I2C, SPI and UART
Note that in CircuitPython, there is a board object each for STEMMA QT, I2C, SPI and UART that use the connector and pins labeled on the Metro. You can use these objects to initialize these peripherals in your code.
-
board.STEMMA_I2C()
uses the STEMMA QT connector (in this case, SCL/SDA pins) -
board.I2C()
uses SCL/SDA pins (GPIO17 and GPIO16) -
board.SPI()
uses SCK/MO/MI pins (GPIO18, GPIO19 and GPIO20) -
board.UART()
uses TX/RX pins (GPIO0 and GPIO1)
Arduino I2C, SPI and UART
I2C, SPI and UART can be accessed with these objects in Arduino:
-
Wire
is used for the default I2C and STEMMA QT connector (GPIO16 and GPIO17). -
SPI
is used for the default SPI pins (GPIO18, GPIO19 and GPIO20). -
Serial1
is used for the default UART pins (GPIO0 and GPIO1).
GPIO Pins by Pin Functionality
Primary pins based on the silkscreen pin labels are bold.
I2C Pins
- I2C0 SCL: SCL, A3, D25, RX, D17, D13, D9, D5
- I2C0 SDA: SDA, A2, D24, TX, D20, D16, D12, D8, D4
- I2C1 SCL: A1, D19, D11, D7, D3
- I2C1 SDA: A0, D18, D10, D6, D2
SPI Pins
- SPI0 SCK: SCK, D6, D2
- SPI0 MOSI: MOSI, D7, D3
- SPI0 MISO: MISO, TX, D16, D4
- SPI0 CS: RX, D5, D17
- SPI1 SCK: A0, D10
- SPI1 MOSI: A1, D11
- SPI1 MISO: A2, D24, D12, D8
- SPI1 CS: A3, D25, D13, D9
UART Pins
- UART0 TX: TX, A2, D12, D16
- UART0 RX: RX, A3, D13, D4, D17
- UART1 TX: D24, D4, D8, MISO
- UART1 RX: D25, D9, D5
PWM Pins
- PWM0 A: TX, SDA
- PWM0 B: RX, SCL
- PWM1 A: D2, SCK
- PWM1 B: D3, MOSI
- PWM2 A: D4, MISO
- PWM2 B: D5
- PWM3 A: D6
- PWM3 B: D7
- PWM4 A: D24, D8
- PWM4 B: D25, D9
- PWM5 A: A0, D10
- PWM5 B: A1, D11
- PWM6 A: A2, D12
- PWM6 B: A3, D13
The switch located at the top right corner of the board near the Boot button is the RX/TX switch.
When the switch is to the left, the pins are as follows:
- RX = 0
- TX = 1
When the switch is to the right, the pins are as follows:
- RX = 1
- TX = 0
You may be wondering about the RX-TX switch: we added this because traditional Arduino board start counting the GPIO for the digital pins with 0-7 and then 8-13. However, the D0/D1 pins are also traditionally the hardware UART Serial1, where D0 is Rx and D1 is Tx. On the RP2040, however, the UART pins are the other around: D0 is Tx and D1 is Rx.
Thus a DPDT switch: flip one way to have the GPIO go in order of 0-7, flip the other way to have the logical locations of the hardware UART correct but now the pin order is 1, 0, 2, 3..7. Of course, it's also handy if, like us, you often swap the pins - now you don't need to rewire or cut and solder traces!
The square above the RP2040 label on the board silk is the RP2040 microcontroller, the "brains" of the Metro RP2040 board.
The square near the TX/RX switch is the QSPI Flash. It is connected to 6 pins that are not brought out on the GPIO pads. This way you don't have to worry about the SPI flash memory accesses colliding with other devices on the main SPI connection.
QSPI is neat because it allows you to have 4 data in/out lines instead of just SPI's single line in and single line out. This means that QSPI is at least 4 times faster. But in reality is at least 10x faster because you can clock the QSPI peripheral much faster than a plain SPI peripheral.
The Metro RP2040 comes with 16 MB of flash memory, which is shared between the program it's running and any file storage used by MicroPython or CircuitPython. When using C/C++, you get the whole flash memory, if using Python, you will have about 7 MB remaining for code, files, images, fonts, etc.
-
NeoPixel LED - This addressable RGB NeoPixel LED is both a status LED and user controllable on 14. It is available in CircuitPython as
board.NEOPIXEL
, and in Arduino asPIN_NEOPIXEL
. -
LED - This red LED on 13 is user controllable for blinky needs. It is available in CircuitPython as
board.LED
and in Arduino asPIN_LED
. - On LED - This green LED indicates the board is powered on, it is connected to the 3.3V power supply.
STEMMA QT - This JST SH 4-pin connector breaks out I2C (SCL, SDA, 3.3V, GND). It allows you to connect to various breakouts and sensors with STEMMA QT connectors or to other things using assorted associated accessories.
Works great with any STEMMA QT or Qwiic sensor/device. You can also use it with Grove I2C devices thanks to this handy cable.
In CircuitPython, you can use the STEMMA connector with board.SCL
and board.SDA
, or board.STEMMA_I2C()
.
In Arduino, you can use the STEMMA connector with 16
(SCL) and 17
(SDA), or Wire
.
The Metro RP2040 comes with a microSD card slot. It is wired up for SPI interfacing. It also has extra pins connected for advanced-user SDIO interfacing (note that there's no released usage code for SDIO in Arduino/Python, so this is a super-cutting-edge setup).
These are the pins for the MicroSD card slot.
- SD_CD/GPIO15 - This is the card detect pin. It is also SPI1 MOSI, I2C1 SCL, and PWM7 B.
- SCK/GPIO18 - This is the main SPI0 SCK pin. It is also I2C1 SDA, and PWM1 A.
- MOSI/GPIO19 - This is the main SPI0 MOSI pin. It is also I2C1 SCL, and PWM1 B.
- MISO/GPIO20 - This is the main SPI0 MISO pin. It is also UART1 TX, I2C0 SDA, and PWM2 A.
- SDIO_DATA1/GPIO21 - This is the SDIO data1 pin. It is also SPI0 CS, UART1 RX, I2C0 SCL and PWM2 B.
- SDIO_DATA2/GPIO22 - This is the SDIO data2 pin. It is also SPI0 SCK, I2C1 SDA, and PWM3 A.
- SD_CS/GPIO23 - This is the chip select pin. It is also SPI0 MOSI, I2C1 SCL, and PWM3 B.
- The RESET button restarts the board and helps enter the bootloader. You can click it to reset the board without unplugging the USB cable or battery.
- The RST pin is can be used to reset the board. Tie to ground manually to reset the board.
- The Boot button is used to enter the bootloader.
To enter the bootloader, press and hold Boot and then power up the board (either by plugging it into USB or pressing RESET). The bootloader is used to install/update CircuitPython. It is also sometimes necessary to enter the bootloader to load an Arduino sketch.
There are two different debug interfaces on the Metro RP2040:
- Debug - The Pico Probe debug port
- SWD - The JTAG interface
The connector labeled Debug is the Pico Probe debug port. The Raspberry Pi Debug Probe is an all-in-one USB-to-debug kit that provides all the necessary hardware and cables for easy, solderless, plug-and-play debugging. For when "printf-style-debugging" just isn't enough, this kit which brings the power of gdb & OpenOCD step and trace debugging to the RP2040 chipset.
The connector labeled SWD is the JTAG debug interface, available if you'd like to do more advanced development, trace-debugging, or not use the bootloader. A J-Link or similar external hardware device is needed to perform debugging.
Text editor powered by tinymce.