-
Notifications
You must be signed in to change notification settings - Fork 22
MCU Info Page: RP2040
MCU RP2040 feature overview
CPU | Flash/Code Memory | RAM | Communication Peripherals | Other Features |
---|---|---|---|---|
133 MHz dual Cortex-M0+. Note that only core 0 is currently supported by Mbed. | 2 MB Flash memory (ext. on-board chip) |
264 KB SRAM (in six independent banks) |
|
|
- Datasheet and Reference Manual: RP2040
- For more manuals or notes visit raspberrypi.com page
Board features
- Small foot-print
- TODO
Board limitations
- TODO
If you're using a Raspberry Pi Pico with Mbed, you have two options for how to program it.
The first option is to load files to the board directly using its bootloader. This requires no extra hardware, but requires a manual procedure (hold down BOOT or BOOTSEL, then plug in the USB) each time you wish to program the board.
Before the bootloader can be used, the picotool
loader program must be installed. On Windows, you may download a binary for the tool here and copy it into any location on your PATH. For other platforms, install instructions can be found on the picotool repository.
Now, put your Pico into bootloader mode using the procedure above and run picotool info
in a terminal window. You should see your device show up! This indicates it's ready to be programmed by Mbed. Use "RASPBERRY_PI_PICO" for MBED_TARGET, which tells Mbed to use the USB port as a serial port by default.
You should now be able to load code, such as the hello world program, and see your program's output on the board's USB serial port!
For Windows only: If your device is not showing up, you might need to manually load the WinUSB driver for it. This can be done using Zadig.
If you plan to use your Pico for more advanced development, it might be worthwhile to hook up an SWD debugger. This allows you to program it automatically instead of going through the dance above. Mbed supports any debugger which exposes the CMSIS-DAP interface, including the highly affordable Raspberry Pi Picoprobe and the Makerdiary Pitaya-Link. To hook up the probe, you must:
- Connect the probe ground to your target ground
- Connect the SWDIO and SWCLK signals between the probe and the target
- Connect the probe's UART signals (TX and RX) to the target. (Careful! On the Pitaya-Link, the signal labeled "TX" is actually the receive line and should be connected to your board's TX pin).
Use "RASPBERRY_PI_PICO_SWD" for MBED_TARGET, which activates SWD debug support and activates the serial console on the TX and RX pins. It is recommended to use "OPENOCD" for your UPLOAD_METHOD, though PYOCD may also work. Once Mbed CE is configured and your probe is hooked up, you should be able to flash code using Mbed CE like normal!
The RP2040 supports PWM on all 29 I/O pins, using a fixed muxing architecture:
Basically, there are 8 independent PWM generators, and each GPIO is mapped to either the A or the B output of one of these generators. The A and B outputs must share the same period, but can have independent pulse widths (duty cycles).
Be careful: two pins which are connected to the same output of the same PWM generator can't be both used for PWM at the same time. For example, I could use GPIOs 0 and 17 for PWM at the same time, because one uses generator 0 channel A and the other uses generator 0 channel B. However, I couldn't use GPIOs 0 and 16 for PWM at the same time, because those both use generator 0 channel A.
Since the RP2040 boards lack a separate USB-serial converter chip, by default, Mbed OS uses the USB port as a USB-serial adapter so that you can view what your code is printing. Unfortunately, this prevents the USB port from being used for anything else. To change this behavior, drop the following lines in your mbed_app.json's target_overrides section:
"target.console-usb": false,
"target.console-uart": true
This will redirect the debug console to the TX and RX pins instead (pins 0 and 1), freeing up the USB port for your application to use. Of course, you'll need to connect an external 3.3V USB-serial adapter to those pins if you want to view your debug console...
Note: If you use the RASPBERRY_PI_PICO_SWDconfiguration, the above configuration change is applied automatically.
On this processor, the RTC cannot keep time through a reset. It will revert back to being uninitialized, and you must write a new time to it before you can use it.
TODO