The ItsyBitsy RP2040 has a ton of pins, and many pins have multiple functions. This page is a detailed tour of the board. Let's go!
- The ItsyBitsy RP2040 has a Micro USB connector on the left in the image above. This connector is used to power and program the board. Use a Micro USB cable to plug the ItsyBitsy into your computer.
Along with the Micro USB connector, the ItsyBitsy has eight power-related pins.
Along the top edge:
- BAT - battery input for an alternative power source to USB, the voltage can only be from 3.5V to 6VDC
- G - This is ground for power and data.
- USB - This is the same pin as the MicroUSB connector's 5V USB power pin. This should be used as an output to get 5V power from the USB port. Say if you need to power a bunch of NeoPixels or servos.
You can always put any voltage you like into BAT and the circuitry will switch between BAT and USB dynamically for you. That means you can have a Batter backup that only gets enabled when USB is disconnected.
If you want to add rechargeable power, a LiPoly backpack can be soldered into these three pins that will let you have a battery that is automatically recharged whenever USB is plugged in, then switches to LiPoly when on the go:
Along the bottom edge:
- RST - This is the reset pin. Tie to ground to manually reset the board.
- 3.3V (x 2) - These two pins are the regulated output from the onboard regulator. You can draw 500mA whether powered by USB or battery.
- VHI - This is a special pin! It is a dual-Schottky diode connected output from BAT and USB. This means this will always have the higher-of-the-two voltages, but will always have power output. The voltage will be about 5VDC when powered by USB, but can range from 3.5-6VDC when powered from battery. It's not regulated, but it is high-current, great for driving servos and NeoPixels.
And on the short edge:
- E/En - This pin is connected to the regulator enable. It will let you shut off power - when running on battery only. But at least you don't have to cut a trace or wire to your battery. This pin does not affect power when using USB.
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 ItsyBitsy 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 ItsyBitsy 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 D12, because they are both PWM5 A. The PWM slices and outputs are indicated below.
The RP2040 has four ADCs. These pins are the only pins capable of handling analog, and they can also do digital.
- A0/GP26 - This pin is ADC0. It is also SPI1 SCK, I2C1 SDA and PWM5 A.
- A1/GP27 - This pin is ADC1. It is also SPI1 MOSI, I2C1 SCL and PWM5 B.
- A2/GP28 - This pin is ADC2. It is also SPI1 MISO, I2C1 SDA and PWM6 A.
- A3/GP29 - This pin is ADC3. It is also SPI1 CS, I2C0 SCL and PWM6 B.
These are the digital I/O pins along the bottom edge. They all have multiple capabilities.
- D24/GP24 - Digital I/O pin 24. It is also UART1 TX, I2C0 SDA, and PWM4 A.
- D25/GP25 - Digital I/O pin 25. It is also UART1 RX, I2C0 SCL, and PWM4 B.
- SCK/GP18 - The main SPI0 SCK. It is also I2C1 SDA and PWM1 A.
- MO/GP19 - The main SPI0 MOSI. It is also I2C1 SCL and PWM1 B.
- MI/GP20 - The main SPI0 MISO. It is also UART1 TX, I2C0 SDA and PWM2 A.
These are the digital I/O pins along the top edge. They all have multiple capabilities.
- D13/GP11 - Digital I/O pin 13. It is also SPI1 MOSI, I2C1 SCL and PWM5 B.
- D12/GP10 - Digital I/O pin 12. It is also SPI1 SCK, I2C1 SDA and PWM5 A.
- D11/GP09 - Digital I/O pin 11. It is also SPI1 CS, UART1 RX, I2C0 SCL and PWM4 B.
- D10/GP08 - Digital I/O pin 10. It is also SPI1 MISO, UART1 TX, I2C0 SDA and PWM4 A.
- D9/GP07 - Digital I/O pin 9. It is also SPI0 MOSI, I2C1 SCL and PWM3 B.
- D7/GP06 - Digital I/O pin 7. It is also SPI0 SCK, I2C1 SDA and PWM3 A.
- D5/GP14 - Digital I/O pin 5. It us also SPI0 MISO, UART0 TX, I2C0 SDA and PWM0 A.
- SCL/GP03 - The main I2C1 clock pin. It is also SPI0 MOSI and PWM1 B.
- SDA/GP02 - The main I2C1 data pin. It is also SPI0 SCK and PWM1 A.
- RX/GP01 - The main UART0 RX pin. It is also I2C0 SDA, SPI0 CS and PWM0 B.
- TX/GP00 - The main UART0 TX pin. It is also I2C0 SCL, SPI0 MISO and PWM0 A.
These are the digital I/O pins along the short edge. They all have multiple capabilities.
- D2/GP12 - Digital I/O pin 2. It is also SPI1 MISO, UART0 TX, I2C0 SDA and PWM6 A.
- D3/GP05 - Digital I/O pin 3. It is also SPI0 CS, UART1 RX, I2C0 SCL and PWM2 B.
- D4/GP04 - Digital I/O pin 4. It is also SPI0 MISO, UART1 TX, I2C0 SDA and PWM2 A.
CircuitPython Pins vs GPxx Pins
There are pin labels on both sides of the ItsyBitsy RP2040. Which should you use? In CircuitPython, use the pin labels on the top of the board (such as A0, D4, SCL, RX, etc.). If you're looking to work with this board and the RP2040 SDK, use the pin labels on the bottom of the board (GP00 and GP01, etc.).
CircuitPython I2C, SPI and UART
Note that in CircuitPython, there is a board object each for I2C, SPI and UART that use the pins labeled on the ItsyBitsy. You can use these objects to initialise these peripherals in your code.
Primary pins based on ItsyBitsy RP2040 silk are bold.
- I2C0 SCL: A3, D25, D11, TX, D3
- I2C0 SDA: D24, MI, D10, D5, RX, D2, D4
- I2C1 SCL: SCL, A1, MO, D13, D9
- I2C1 SDA: SDA, A0, A2, SCK, D12, D7
- SPI0 SCK: SCK, D7, SDA
- SPI0 MOSI: MO, D9, SCL
- SPI0 MISO: MI, D5, TX, D4
- SPI0 CS: RX, D3
- SPI1 SCK: A0, D12
- SPI1 MOSI: A1, D13
- SPI1 MISO: A2, D10, D2
- SPI1 CS: A3, D11
- UART0 TX: TX, D5, D2
- UART0 RX: RX
- UART1 TX: D24. MI, D10, D4
- UART1 RX: D25, D11, D3
- PWM0 A: TX, D5
- PWM0 B: RX
- PWM1 A: SCK, SDA
- PWM1 B: MO, SCL
- PWM2 A: MI, D4
- PWM2 B: D3
- PWM3 A: D7
- PWM3 B: D9
- PWM4 A: D24, D10
- PWM4 B: D24, D11
- PWM5 A: A0, D12
- PWM5 B: A1, D13
- PWM6 A: A2, D2
- PWM6 B: A3
The square towards the middle is the RP2040 microcontroller, the "brains" of the ItsyBitsy RP2040 board.
The square between the buttons 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 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 ItsyBitsy RP2040 has two buttons.
The BOOT (boot select) 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 RST). The bootloader is used to install/update CircuitPython. This button is also usable as an input in CircuitPython code, on pin
board.BUTTON. It is on RP2040 pin GPIO13.
The RST button (reset) restarts the board and helps enter the bootloader. You can click it to reset the board without unplugging the USB cable or battery.
The little red LED is located towards the middle of the board between 13 and 12 on the silk. It is controllable in CircuitPython code using the pin
board.LED. It is on RP2040 pin GPIO11.
The RGB NeoPixel LED is located near A0 and A1 on the silk. It is controllable in CircuitPython code using the pin
board.NEOPIXEL. It is on RP2040 pin GPIO17.
On the short edge of the board are the SWCLK and SWDIO pins. They provide access to the internal Serial Wire Debug multi-drop bus, which provides debug access to both processors, and can be used to download code.