|
| 1 | +.. zephyr:board:: pico_spe |
| 2 | +
|
| 3 | +Overview |
| 4 | +******** |
| 5 | + |
| 6 | +The Pico-SPE is a small, low-cost, versatile boards from |
| 7 | +KWS Computersysteme Gmbh. They are equipped with an RP2040 SoC, an on-board LED, |
| 8 | +a USB connector, an SWD interface. The Pico-SPE additionally contains an |
| 9 | +Microchip LAN8651 10Base-T1S module. The USB bootloader allows the |
| 10 | +ability to flash without any adapter, in a drag-and-drop manner. |
| 11 | +It is also possible to flash and debug the boards with their SWD interface, |
| 12 | +using an external adapter. |
| 13 | + |
| 14 | +Hardware |
| 15 | +******** |
| 16 | +- Dual core Arm Cortex-M0+ processor running up to 133MHz |
| 17 | +- 264KB on-chip SRAM |
| 18 | +- 16MB on-board QSPI flash with XIP capabilities |
| 19 | +- 16 GPIO pins |
| 20 | +- 3 Analog inputs |
| 21 | +- 2 UART peripherals |
| 22 | +- 2 I2C controllers |
| 23 | +- 16 PWM channels |
| 24 | +- USB 1.1 controller (host/device) |
| 25 | +- 8 Programmable I/O (PIO) for custom peripherals |
| 26 | +- On-board LED |
| 27 | +- 1 Watchdog timer peripheral |
| 28 | +- Microchip LAN8651 10Base-T1S |
| 29 | + |
| 30 | +Supported Features |
| 31 | +================== |
| 32 | + |
| 33 | +The ``pico_spe`` board target supports the following |
| 34 | +hardware features: |
| 35 | + |
| 36 | +.. list-table:: |
| 37 | + :header-rows: 1 |
| 38 | + |
| 39 | + * - Peripheral |
| 40 | + - Kconfig option |
| 41 | + - Devicetree compatible |
| 42 | + * - NVIC |
| 43 | + - N/A |
| 44 | + - :dtcompatible:`arm,v6m-nvic` |
| 45 | + * - UART |
| 46 | + - :kconfig:option:`CONFIG_SERIAL` |
| 47 | + - :dtcompatible:`raspberrypi,pico-uart` |
| 48 | + * - GPIO |
| 49 | + - :kconfig:option:`CONFIG_GPIO` |
| 50 | + - :dtcompatible:`raspberrypi,pico-gpio` |
| 51 | + * - ADC |
| 52 | + - :kconfig:option:`CONFIG_ADC` |
| 53 | + - :dtcompatible:`raspberrypi,pico-adc` |
| 54 | + * - I2C |
| 55 | + - :kconfig:option:`CONFIG_I2C` |
| 56 | + - :dtcompatible:`snps,designware-i2c` |
| 57 | + * - SPI |
| 58 | + - :kconfig:option:`CONFIG_SPI` |
| 59 | + - :dtcompatible:`raspberrypi,pico-spi` |
| 60 | + * - USB Device |
| 61 | + - :kconfig:option:`CONFIG_USB_DEVICE_STACK` |
| 62 | + - :dtcompatible:`raspberrypi,pico-usbd` |
| 63 | + * - HWINFO |
| 64 | + - :kconfig:option:`CONFIG_HWINFO` |
| 65 | + - N/A |
| 66 | + * - Watchdog Timer (WDT) |
| 67 | + - :kconfig:option:`CONFIG_WATCHDOG` |
| 68 | + - :dtcompatible:`raspberrypi,pico-watchdog` |
| 69 | + * - PWM |
| 70 | + - :kconfig:option:`CONFIG_PWM` |
| 71 | + - :dtcompatible:`raspberrypi,pico-pwm` |
| 72 | + * - Flash |
| 73 | + - :kconfig:option:`CONFIG_FLASH` |
| 74 | + - :dtcompatible:`raspberrypi,pico-flash` |
| 75 | + * - Clock controller |
| 76 | + - :kconfig:option:`CONFIG_CLOCK_CONTROL` |
| 77 | + - :dtcompatible:`raspberrypi,pico-clock-controller` |
| 78 | + * - UART (PIO) |
| 79 | + - :kconfig:option:`CONFIG_SERIAL` |
| 80 | + - :dtcompatible:`raspberrypi,pico-uart-pio` |
| 81 | + * - SPI (PIO) |
| 82 | + - :kconfig:option:`CONFIG_SPI` |
| 83 | + - :dtcompatible:`raspberrypi,pico-spi-pio` |
| 84 | + * - LAN8651 Single Pair Ethernet |
| 85 | + - :kconfig:option:`CONFIG_NETWORKING` |
| 86 | + - :dtcompatible:`microchip,lan865x` |
| 87 | + |
| 88 | +Pin Mapping |
| 89 | +=========== |
| 90 | + |
| 91 | +The peripherals of the RP2040 SoC can be routed to various pins on the board. |
| 92 | +The configuration of these routes can be modified through DTS. Please refer to |
| 93 | +the datasheet to see the possible routings for each peripheral. |
| 94 | + |
| 95 | +External pin mapping on the Pico-SPE is identical to the Pico, but note that internal |
| 96 | +RP2040 GPIO lines 10, 11, 12, 13, 20, 21 are routed to the Microchip LAN8651 on the |
| 97 | +Pico-SPE. |
| 98 | + |
| 99 | +Default Zephyr Peripheral Mapping: |
| 100 | +---------------------------------- |
| 101 | + |
| 102 | +.. rst-class:: rst-columns |
| 103 | + |
| 104 | +- UART0_TX : P0 |
| 105 | +- UART0_RX : P1 |
| 106 | +- I2C0_SDA : P4 |
| 107 | +- I2C0_SCL : P5 |
| 108 | +- I2C1_SDA : P6 |
| 109 | +- I2C1_SCL : P7 |
| 110 | +- ADC_CH0 : P26 |
| 111 | +- ADC_CH1 : P27 |
| 112 | +- ADC_CH2 : P28 |
| 113 | + |
| 114 | +Programmable I/O (PIO) |
| 115 | +********************** |
| 116 | +The RP2040 SoC comes with two PIO periherals. These are two simple |
| 117 | +co-processors that are designed for I/O operations. The PIOs run |
| 118 | +a custom instruction set, generated from a custom assembly language. |
| 119 | +PIO programs are assembled using :command:`pioasm`, a tool provided by Raspberry Pi. |
| 120 | + |
| 121 | +Zephyr does not (currently) assemble PIO programs. Rather, they should be |
| 122 | +manually assembled and embedded in source code. An example of how this is done |
| 123 | +can be found at :zephyr_file:`drivers/serial/uart_rpi_pico_pio.c`. |
| 124 | + |
| 125 | +Sample: SPI via PIO |
| 126 | +==================== |
| 127 | + |
| 128 | +The :zephyr:code-sample:`bme280` sample includes a |
| 129 | +demonstration of using the PIO SPI driver to communicate with an |
| 130 | +environmental sensor. The PIO SPI driver supports using any |
| 131 | +combination of GPIO pins for an SPI bus, as well as allowing up to |
| 132 | +four independent SPI buses on a single board (using the two SPI |
| 133 | +devices as well as both PIO devices). |
| 134 | + |
| 135 | +Programming and Debugging |
| 136 | +************************* |
| 137 | + |
| 138 | +Flashing |
| 139 | +======== |
| 140 | + |
| 141 | +Using SEGGER JLink |
| 142 | +------------------ |
| 143 | + |
| 144 | +You can Flash the pico_spe with a SEGGER JLink debug probe as described in |
| 145 | +:ref:`Building, Flashing and Debugging <west-flashing>`. |
| 146 | + |
| 147 | +Here is an example of building and flashing the :zephyr:code-sample:`blinky` application. |
| 148 | + |
| 149 | +.. zephyr-app-commands:: |
| 150 | + :zephyr-app: samples/basic/blinky |
| 151 | + :board: pico_spe |
| 152 | + :goals: build |
| 153 | + |
| 154 | +.. code-block:: bash |
| 155 | +
|
| 156 | + west flash --runner jlink |
| 157 | +
|
| 158 | +Using OpenOCD |
| 159 | +------------- |
| 160 | + |
| 161 | +To use CMSIS-DAP, you must configure **udev**. |
| 162 | + |
| 163 | +Create a file in /etc/udev.rules.d with any name, and write the line below. |
| 164 | + |
| 165 | +.. code-block:: bash |
| 166 | +
|
| 167 | + ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="000c", MODE="660", GROUP="plugdev", TAG+="uaccess" |
| 168 | +
|
| 169 | +This example is valid for the case that the user joins to ``plugdev`` groups. |
| 170 | + |
| 171 | +The Pico-SPE has an SWD interface that can be used to program |
| 172 | +and debug the on board RP2040. This interface can be utilized by OpenOCD. |
| 173 | +To use it with the RP2040, OpenOCD version 0.12.0 or later is needed. |
| 174 | + |
| 175 | +If you are using a Debian based system (including RaspberryPi OS, Ubuntu. and more), |
| 176 | +using the `pico_setup.sh`_ script is a convenient way to set up the forked version of OpenOCD. |
| 177 | + |
| 178 | +Depending on the interface used (such as JLink), you might need to |
| 179 | +checkout to a branch that supports this interface, before proceeding. |
| 180 | +Build and install OpenOCD as described in the README. |
| 181 | + |
| 182 | +Here is an example of building and flashing the :zephyr:code-sample:`blinky` application. |
| 183 | + |
| 184 | +.. zephyr-app-commands:: |
| 185 | + :zephyr-app: samples/basic/blinky |
| 186 | + :board: pico_spe |
| 187 | + :goals: build flash |
| 188 | + :gen-args: -DOPENOCD=/usr/local/bin/openocd -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts -DRPI_PICO_DEBUG_ADAPTER=cmsis-dap |
| 189 | + |
| 190 | +Set the environment variables **OPENOCD** to :file:`/usr/local/bin/openocd` |
| 191 | +and **OPENOCD_DEFAULT_PATH** to :file:`/usr/local/share/openocd/scripts`. This should work |
| 192 | +with the OpenOCD that was installed with the default configuration. |
| 193 | +This configuration also works with an environment that is set up by the `pico_setup.sh`_ script. |
| 194 | + |
| 195 | +**RPI_PICO_DEBUG_ADAPTER** specifies what debug adapter is used for debugging. |
| 196 | + |
| 197 | +If **RPI_PICO_DEBUG_ADAPTER** was not assigned, ``cmsis-dap`` is used by default. |
| 198 | +The other supported adapters are ``raspberrypi-swd``, ``jlink`` and ``blackmagicprobe``. |
| 199 | +How to connect ``cmsis-dap`` and ``raspberrypi-swd`` is described in `Getting Started with Pico-SPE`_. |
| 200 | +Any other SWD debug adapter maybe also work with this configuration. |
| 201 | + |
| 202 | +The value of **RPI_PICO_DEBUG_ADAPTER** is cached, so it can be omitted from |
| 203 | +``west flash`` and ``west debug`` if it was previously set while running |
| 204 | +``west build``. |
| 205 | + |
| 206 | +**RPI_PICO_DEBUG_ADAPTER** is used in an argument to OpenOCD as ``"source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]"``. |
| 207 | +Thus, **RPI_PICO_DEBUG_ADAPTER** needs to be assigned the file name of the debug adapter. |
| 208 | + |
| 209 | +You can also flash the board with the following |
| 210 | +command that directly calls OpenOCD (assuming a SEGGER JLink adapter is used): |
| 211 | + |
| 212 | +.. code-block:: console |
| 213 | +
|
| 214 | + $ 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' |
| 215 | +
|
| 216 | +Using UF2 |
| 217 | +--------- |
| 218 | + |
| 219 | +If you don't have an SWD adapter, you can flash the Pico-SPE with |
| 220 | +a UF2 file. By default, building an app for this board will generate a |
| 221 | +:file:`build/zephyr/zephyr.uf2` file. If the Pico is powered on with the ``BOOTSEL`` |
| 222 | +button pressed, it will appear on the host as a mass storage device. The |
| 223 | +UF2 file should be drag-and-dropped to the device, which will flash the Pico. |
| 224 | + |
| 225 | +Debugging |
| 226 | +========= |
| 227 | + |
| 228 | +The SWD interface can also be used to debug the board. To achieve this, you can |
| 229 | +either use SEGGER JLink or OpenOCD. |
| 230 | + |
| 231 | +Using SEGGER JLink |
| 232 | +------------------ |
| 233 | + |
| 234 | +Use a SEGGER JLink debug probe and follow the instruction in |
| 235 | +:ref:`Building, Flashing and Debugging<west-debugging>`. |
| 236 | + |
| 237 | + |
| 238 | +Using OpenOCD |
| 239 | +------------- |
| 240 | + |
| 241 | +Install OpenOCD as described for flashing the board. |
| 242 | + |
| 243 | +Here is an example for debugging the :zephyr:code-sample:`blinky` application. |
| 244 | + |
| 245 | +.. zephyr-app-commands:: |
| 246 | + :zephyr-app: samples/basic/blinky |
| 247 | + :board: pico_spe |
| 248 | + :maybe-skip-config: |
| 249 | + :goals: debug |
| 250 | + :gen-args: -DOPENOCD=/usr/local/bin/openocd -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts -DRPI_PICO_DEBUG_ADAPTER=raspberrypi-swd |
| 251 | + |
| 252 | +As with flashing, you can specify the debug adapter by specifying **RPI_PICO_DEBUG_ADAPTER** |
| 253 | +at ``west build`` time. No needs to specify it at ``west debug`` time. |
| 254 | + |
| 255 | +You can also debug with OpenOCD and gdb launching from command-line. |
| 256 | +Run the following command: |
| 257 | + |
| 258 | +.. code-block:: console |
| 259 | +
|
| 260 | + $ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0' |
| 261 | +
|
| 262 | +On another terminal, run: |
| 263 | + |
| 264 | +.. code-block:: console |
| 265 | +
|
| 266 | + $ gdb-multiarch |
| 267 | +
|
| 268 | +Inside gdb, run: |
| 269 | + |
| 270 | +.. code-block:: console |
| 271 | +
|
| 272 | + (gdb) tar ext :3333 |
| 273 | + (gdb) file path/to/zephyr.elf |
| 274 | +
|
| 275 | +You can then start debugging the board. |
| 276 | + |
| 277 | +.. target-notes:: |
| 278 | +.. _pico_setup.sh: |
| 279 | + https://raw.githubusercontent.com/raspberrypi/pico-setup/master/pico_setup.sh |
| 280 | + |
| 281 | +.. _Getting Started with Pico-SPE: |
| 282 | + https://kws-computer.de/go/pico-spe-getting-started |
| 283 | + |
| 284 | +.. _Pico-SPE Documentation: |
| 285 | + https://kws-computer.de/go/pico-spe-datasheet |
0 commit comments