|
| 1 | +.. _rpi_pico: |
| 2 | + |
| 3 | +Raspberry Pi Pico |
| 4 | +################# |
| 5 | + |
| 6 | +Overview |
| 7 | +******** |
| 8 | + |
| 9 | +The Raspberry Pi Pico is a small, low-cost, versatile board from |
| 10 | +Raspberry Pi. It is equipped with an RP2040 SoC, an on-board LED, |
| 11 | +a USB connector, and an SWD interface. The USB bootloader allows it |
| 12 | +to be flashed without any adapter, in a drag-and-drop manner. |
| 13 | +It is also possible to flash and debug the Pico with its SWD interface, |
| 14 | +using an external adapter. |
| 15 | + |
| 16 | +Hardware |
| 17 | +******** |
| 18 | +- Dual core Arm Cortex-M0+ processor running up to 133MHz |
| 19 | +- 264KB on-chip SRAM |
| 20 | +- 2MB on-board QSPI flash with XIP capabilities |
| 21 | +- 26 GPIO pins |
| 22 | +- 3 Analog inputs |
| 23 | +- 2 UART peripherals |
| 24 | +- 2 SPI controllers |
| 25 | +- 2 I2C controllers |
| 26 | +- 16 PWM channels |
| 27 | +- USB 1.1 controller (host/device) |
| 28 | +- 8 Programmable I/O (PIO) for custom peripherals |
| 29 | +- On-board LED |
| 30 | + |
| 31 | + |
| 32 | +.. figure:: img/rpi_pico.png |
| 33 | + :width: 150px |
| 34 | + :align: center |
| 35 | + :alt: Raspberry Pi Pico |
| 36 | + |
| 37 | + Raspberry Pi Pico (Image courtesy of Raspberry Pi) |
| 38 | + |
| 39 | +Supported Features |
| 40 | +================== |
| 41 | + |
| 42 | +The rpi_pico board configuration supports the following |
| 43 | +hardware features: |
| 44 | + |
| 45 | +.. list-table:: |
| 46 | + :header-rows: 1 |
| 47 | + |
| 48 | + * - Peripheral |
| 49 | + - Kconfig option |
| 50 | + - Devicetree compatible |
| 51 | + * - NVIC |
| 52 | + - N/A |
| 53 | + - :dtcompatible:`arm,v6m-nvic` |
| 54 | + * - UART |
| 55 | + - :kconfig:`CONFIG_SERIAL` |
| 56 | + - :dtcompatible:`rpi,pico-uart` |
| 57 | + * - GPIO |
| 58 | + - :kconfig:`CONFIG_GPIO` |
| 59 | + - :dtcompatible:`rpi,pico-gpio` |
| 60 | + |
| 61 | +Programming and Debugging |
| 62 | +************************* |
| 63 | + |
| 64 | +Flashing |
| 65 | +======== |
| 66 | + |
| 67 | +Using an SWD adapter |
| 68 | +-------------------- |
| 69 | + |
| 70 | +The Raspberry Pi Pico has an SWD interface that can be used to program |
| 71 | +and debug the on board RP2040. This interface can be utilized by openocd. |
| 72 | +However, to use it with the RP2040, a custom fork of openocd is needed. |
| 73 | +This fork can be found here: https://github.com/raspberrypi/openocd |
| 74 | + |
| 75 | +Depending on the interface used (such as JLink), you might need to |
| 76 | +checkout to a branch that supports this interface, before proceeding. |
| 77 | +Build and install openocd as described in the README. |
| 78 | + |
| 79 | +When openocd is installed, you can flash the board with the following |
| 80 | +command (assuming JLink is used): |
| 81 | + |
| 82 | +.. code-block:: console |
| 83 | +
|
| 84 | + $ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0' -c 'program path/to/zephyr.elf verify reset exit' |
| 85 | +
|
| 86 | +Debugging |
| 87 | +========= |
| 88 | + |
| 89 | +The SWD interface can also be used to debug the board. To achieve this, |
| 90 | +install openocd as described for flashing the board. Also, install gdb-multiarch. |
| 91 | +Then run the following command: |
| 92 | + |
| 93 | +.. code-block:: console |
| 94 | +
|
| 95 | + $ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0' |
| 96 | +
|
| 97 | +On another terminal, run: |
| 98 | + |
| 99 | +.. code-block:: console |
| 100 | +
|
| 101 | + $ gdb-multiarch |
| 102 | +
|
| 103 | +Inside gdb, run: |
| 104 | + |
| 105 | +.. code-block:: console |
| 106 | +
|
| 107 | + (gdb) tar ext :3333 |
| 108 | + (gdb) file path/to/zephyr.elf |
| 109 | +
|
| 110 | +You can then start debugging the board. |
0 commit comments