Maker.io main logo

Hardware Design with the RP2040 Part 1: Schematic

2021-06-21 | By ShawnHymel

License: Attribution

The RP2040 is a slick, new microcontroller from Raspberry Pi. While the Raspberry Pi Pico is gaining most of the attention as a maker or prototyping board, the RP2040 (the brains on the Pico) can be used just like any other microcontroller. By that, we mean you can create your own printed circuit board (PCB) for it.

We’ll give you some tips that you should keep in mind while creating your own RP2040-based board.

The board schematic and layout files (created in KiCad v5.1) can be found here: https://github.com/ShawnHymel/rpi-pico-debugger-shoe

See here if you would like to view this content in video form:

 

Recommended Reading

Before getting started, we highly recommend going over some documents (or videos) or having them handy to use as a reference:

What am I Making?

This is really a demonstration of creating a working PCB for the RP2040 more than anything. You are welcome to take this design and use it as a starting point for your own projects. However, for my purposes, I wanted to make a “debugger helper” of sorts. To use the picoprobe debugger right now, you have to wire up 2 separate Pico boards, which can take up a lot of space on a breadboard.

Picoprobe connections

My goal was to create a “shoe” (yes, as opposed to a “hat”) that sits under the target Pico that connects via SWD and UART pins to provide debugging support without taking up extra breadboard space. I’d still need to connect the SWD pins manually, but it creates a much cleaner step-through debugging and prototyping experience in my opinion. It’s probably overkill, but it was a fun project for me.

Stacking Pico debugger shoe

The extra long pins on the shoe are just like the ones you find on many Arduino shields. Most pins on the shoe are not connected and simply pass through the signals from the target Pico to the breadboard. However, the SWD pins and UART (pins 0 and 1) would be connected to the debugger and not available for use.

Finding Parts

At the time of writing, we are in the middle of a global chip shortage. Finding parts is either difficult or expensive. As a result, we had to make a few substitutions for the recommended parts in the RP2040 hardware design guide.

For example, the guide recommends a Winbond Electronics W25Qxx quad-SPI flash memory. However, it gives a list of instructions that must be supported by the flash memory chip. If the chip supports those instructions, then it should be a suitable replacement. So, rather than go with the W25QJVSSIQ (which was out of stock when I ordered parts), I went with the MX25L3233FM2I, which relies on the same instruction set, according to the datasheet.

Edit: I later find that the Macronix chip does not act as a drop-in replacement! If you are reading this with hopes to make your own RP2040-based PCB, I recommend purchasing a Winbond W25Q series flash chip, as those are known to work with the RP2040.

The Raspberry Pi Pico has a full buck-boost converter, which I did not think was necessary for this simple debugger. We just need to drop USB 5V to 3.3V, so a cheaper LDO should suffice. The AP2112K-3.3V fixed voltage LDO is very popular with companies like SparkFun and Adafruit. However, it was also out of stock, so I found a drop-in replacement: the XC6210B332MR-G. It’s more expensive, but it should work for my needs.

Using Pre-Made KiCad Parts

To save time, I highly recommend checking the Digi-Key product page for links to Ultra Librarian or SnapEDA. If you do not see such links, try navigating to either of those sites and searching for your part. Download the KiCad schematic part and footprint for your part. You will probably need to unzip the files. I like to store these third-party libraries in the hardware/<pcb-name>/libaries folder of my project directory.

If you can’t find your part, you will likely need to create your own part and footprint. Make sure to read the datasheet for your part!

Note: the RP2040 Ultra Librarian symbol and footprint can be found here.

After you’ve created your project in KiCad, open the Project Manager window and select Preferences > Manage Symbol Libraries. Go to the Project Specific Libraries tab. Click the folder button to Add existing library to table. Select the .lib file in the downloaded library. Click OK to save.

Adding libraries to KiCad

Next, go to Preferences > Manage Footprint Libraries. Go to the Project Specific Libraries tab. Click the folder button to Add existing library to table. Select the .pretty folder in each downloaded library. Note that the .pretty folders in the Ultra Librarian libraries will all be named footprints.pretty. To avoid conflicts in your library manager, I recommend changing the Nickname to reflect the part name (e.g. rp2040). Click OK to save.

Renaming footprint libraries in KiCad

Schematic

Here is the schematic for my RPi Pico Debugger Shoe. You can find a PDF version of it here.

RP2040 Debugger Shoe schematic

A few notes about the schematic:

  • I used a USB Micro B connector so that it matches the Pico. You’re welcome to swap this for a USB-C connector in your own design. Just be aware that you’ll need some pull-down resistors to make it work.
  • 27 Ω series termination resistors are required on the USB D+ and D- lines.
  • If you name the USB data lines with a _P/_N or +/- suffix, you can tell KiCad to route those lines as a differential pair.
  • The RP2040 requires a single 0.1 μF decoupling capacitor for each IOVDD pin, each DVDD pin, and ADC_AVDD. Make sure you keep these capacitors close to those pins during layout.
  • There is a 1.1V regulator inside the RP2040 used to power the core. You will need to connect 3.3V to the input of this regulator (VREG_VIN) and connect the output (1.1V) to the DVDD pins. The input and output lines should each have a 1 μF decoupling capacitor.
  • 12 MHz is the recommended crystal/oscillator speed in order to get the PLL working in the RP2040 and to have everything work out for USB speeds. Here is a good article explaining how to calculate the supporting capacitor values for the crystal.
  • The RP2040 samples the QSPI_CS line on boot. If this line is low, it will boot into its USB bootloader mode (i.e. enumerate as a mass storage device so you can upload new firmware). If this line is high on boot, it will start reading program instructions from the quad-SPI flash chip.
  • The RUN pin works much like a RESET pin on other microcontrollers. Tie this line to ground if you wish to reset the processor.
  • GPIO2 through GPIO5 are used as UART and SWD host functions in the picoprobe firmware, which is why we connect these to the target Pico on this board.
  • I made the debugger RP2040 SWD pins available, in case I need to debug this chip or upload code the hard way. It should not be connected to the target Pico’s SWD port.

Assigning Footprints

When associating footprints with schematic symbols, I recommend using the provided third-party library footprints for the parts you downloaded. I also recommend verifying that the footprints look OK.

For my board, I chose to use 0603 SMD parts for the supporting capacitors and resistors with “HandSolder” (extra long) pads. This gives me the option to hand solder some of the components. However, it made the layout quite crowded around the RP2040, as the decoupling capacitors competed for space near the power pins.

Associating footprints with symbols in KiCad

Conclusion

The documentation for the RP2040 is fantastic, and I hope this post has helped you get an idea of how to create a schematic for your own RP2040-based PCB! In the next article, I’ll show you some of the things I learned doing the layout.

Recommended Reading

TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum