The first custom microcontroller chip from the Raspberry Pi Foundation, the RP2040, is here and SparkFun has put it on a MicroMod board to integrate with their MicroMod system of carrier boards. With the addition of the RP2040, SparkFun offers seven different microcontroller chips on MicroMod boards. The boards attach via an M.2 socket to your choice of one of eight carrier boards, each having different forms and on-board peripherals.
Looking at the MicroMod board itself, we find an RP2040 microcontroller featuring a dual-core Arm Cortex-M0+ CPU that runs at up to 133MHz. It has 264 kB of SRAM internal and a dedicated QSPI bus for external program storage. The SparkFun designers attached 16MB of flash for the MicroMod, allowing plenty of program space. There is a 12 MHz crystal on the board, which is used to govern the internal configurable clocks of the RP2040. The RP2040 has native support for USB and can function as a client or host. Because the MicroMod connector provides for incoming and outgoing USB connections on different pins, a USB multiplexer has been added to the board, controlled by the presence of an external 5V on the USB bus. A status LED rounds out the board, connected to one of the GPIO pins.
The RP2040 has 30 GPIO pins, and they are very flexible in their assignments. Each pin can be connected to one of the 16-bit PWM timers, or be part of an I2C, UART, or SPI bus, for example. The four pins for the 12-bit ADC are fixed to the last four GPIO pins. The MicroMod connector assigns its pins more specific functions. There are six pins for controlling an SD card socket, for example, and five pins for I2S audio in and out. The RP2040’s flexible GPIO allows it to cover a lot of what the MicroMod connector allows it to offer. A few pins do double duty, like the SPI pins covering four GPIO pins on the MicroMod connector as well. I count only seven pins on the MicroMod connector that are left unattached to the RP2040, which is pretty good coverage. All of the RP2040’s pins are employed serving some function on the connector.
The hookup guide for the MicroMod RP2040 walks through the hardware, the pin assignments and how to program the board. Instructions are given for getting the board running with MicroPython. To use MicroPython, I recommend going straight to the Raspberry Pi foundation’s site to find the necessary files and a guide to usage on the RP2040. (Note their documentation will reference the Pico, the board from Raspberry Pi that carries the RP2040.) Installing the MicroPython firmware is a snap thanks to the UF2 bootloader. Just hold the “boot” button on your carrier board while inserting the USB cable and the MicroMod RP2040 will mount as a USB mass storage device. Drag and drop the UF2 file you downloaded from the Raspberry Pi website and the board will reboot into MicroPython in REPL mode. You can then connect to it with any serial program and issue commands to the board, or use an IDE like Thonny. There is not a lot of support for SparkFun peripherals in MicroPython at this time, including QWIIC system peripherals. This will hopefully change with time.
I decided to see what other programming environments work as they might provide more libraries and example code. I first turned to CircuitPython for the Raspberry Pi Pico, which installed fine using the same method as MicroPython. I was able to blink an LED from Adafruit’s example code with no problems. I then tried Arduino IDE. I did this by installing support for “Arduino Mbed OS RP2040 Boards” in the library manager and then programming the board as if it was a Raspberry Pi Pico. At first, Arduino IDE would give me errors when trying to download a sketch to the board. But after installing CircuitPython, sketches from Arduino IDE would download just fine. I’m not in a position to test all of Arduino IDE’s libraries, but many libraries that are not board-specific will probably work.
There is a final option for programming RP2040 based boards, and that is using the Raspberry Pi Pico C/C++ SDK. I wouldn’t recommend this for beginners, but people familiar with C/C++ IDEs and toolchains will have no problem. Scripts are available to install the entire toolchain on a Raspberry Pi if you intend to use one for development, or there is a Windows installer. The SDK can be used with Visual Studio and other IDEs as described in the official documentation, or you can use it from the command line. The SDK includes a number of example programs.