1.. _w5500_evb_pico: 2 3Wiznet W5500 Evaluation Pico 4############################ 5 6Overview 7******** 8 9W5500-EVB-Pico is a microcontroller evaluation board based on the Raspberry 10Pi RP2040 and fully hardwired TCP/IP controller W5500 - and basically works 11the same as Raspberry Pi Pico board but with additional Ethernet via W5500. 12The USB bootloader allows the ability to flash without any adapter, in a 13drag-and-drop manner. It is also possible to flash and debug the boards with 14their SWD interface, using an external adapter. 15 16Hardware 17******** 18- Dual core Arm Cortex-M0+ processor running up to 133MHz 19- 264KB on-chip SRAM 20- 16MB 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- 1 Watchdog timer peripheral 31- Wiznet W5500 Ethernet MAC/PHY 32 33 34.. figure:: img/w5500_evb_pico_side.png 35 :align: center 36 :alt: W5500 Evaluation Board 37 38 Wiznet W5500_EVB_PICO evaluation board (Image courtesy of Wiznet) 39 40Supported Features 41================== 42 43The w5500_evb_pico board configuration supports the following 44hardware features: 45 46.. list-table:: 47 :header-rows: 1 48 49 * - Peripheral 50 - Kconfig option 51 - Devicetree compatible 52 * - NVIC 53 - N/A 54 - :dtcompatible:`arm,v6m-nvic` 55 * - UART 56 - :kconfig:option:`CONFIG_SERIAL` 57 - :dtcompatible:`raspberrypi,pico-uart` 58 * - GPIO 59 - :kconfig:option:`CONFIG_GPIO` 60 - :dtcompatible:`raspberrypi,pico-gpio` 61 * - ADC 62 - :kconfig:option:`CONFIG_ADC` 63 - :dtcompatible:`raspberrypi,pico-adc` 64 * - I2C 65 - :kconfig:option:`CONFIG_I2C` 66 - :dtcompatible:`snps,designware-i2c` 67 * - SPI 68 - :kconfig:option:`CONFIG_SPI` 69 - :dtcompatible:`raspberrypi,pico-spi` 70 * - USB Device 71 - :kconfig:option:`CONFIG_USB_DEVICE_STACK` 72 - :dtcompatible:`raspberrypi,pico-usbd` 73 * - HWINFO 74 - :kconfig:option:`CONFIG_HWINFO` 75 - N/A 76 * - Watchdog Timer (WDT) 77 - :kconfig:option:`CONFIG_WATCHDOG` 78 - :dtcompatible:`raspberrypi,pico-watchdog` 79 * - PWM 80 - :kconfig:option:`CONFIG_PWM` 81 - :dtcompatible:`raspberrypi,pico-pwm` 82 * - Flash 83 - :kconfig:option:`CONFIG_FLASH` 84 - :dtcompatible:`raspberrypi,pico-flash` 85 * - UART (PIO) 86 - :kconfig:option:`CONFIG_SERIAL` 87 - :dtcompatible:`raspberrypi,pico-uart-pio` 88 * - SPI (PIO) 89 - :kconfig:option:`CONFIG_SPI` 90 - :dtcompatible:`raspberrypi,pico-spi-pio` 91 * - W5500 Ethernet 92 - :kconfig:option:`CONFIG_NETWORKING` 93 - :dtcompatible:`wiznet,w5500` 94 95Pin Mapping 96=========== 97 98The peripherals of the RP2040 SoC can be routed to various pins on the board. 99The configuration of these routes can be modified through DTS. Please refer to 100the datasheet to see the possible routings for each peripheral. 101 102External pin mapping on the W5500_EVB_PICO is identical to the Raspberry Pi 103Pico. Since GPIO 25 is routed to the on-board LED on, similar to the Raspberry 104Pi Pico, the blinky example works as intended. The W5500 is routed to the SPI0 105(P16-P19), with the reset and interrupt signal for the W5500 routed to P20 and 106P21, respectively. All of these are shared with the edge connector on the 107board. 108 109Refer to `W55500 Evaluation Board Documentation`_ for a board schematic and 110other certifications. 111 112Default Zephyr Peripheral Mapping: 113---------------------------------- 114 115.. rst-class:: rst-columns 116 117- UART0_TX : P0 118- UART0_RX : P1 119- I2C0_SDA : P4 120- I2C0_SCL : P5 121- I2C1_SDA : P14 122- I2C1_SCL : P15 123- SPI0_RX : P16 124- SPI0_CSN : P17 125- SPI0_SCK : P18 126- SPI0_TX : P19 127- W5500 Reset : P20 128- W5500 Interrupt : P21 129- ADC_CH0 : P26 130- ADC_CH1 : P27 131- ADC_CH2 : P28 132- ADC_CH3 : P29 133 134Programming and Debugging 135************************* 136 137Flashing 138======== 139 140Using SEGGER JLink 141------------------ 142 143You can Flash the w5500_evb_pico with a SEGGER JLink debug probe as described in 144:ref:`Building, Flashing and Debugging <west-flashing>`. 145 146Here is an example of building and flashing the :zephyr:code-sample:`blinky` application. 147 148.. zephyr-app-commands:: 149 :zephyr-app: samples/basic/blinky 150 :board: w5500_evb_pico 151 :goals: build 152 153.. code-block:: bash 154 155 west flash --runner jlink 156 157Using OpenOCD 158------------- 159 160To use PicoProbe, You must configure **udev**. 161 162Create a file in /etc/udev.rules.d with any name, and write the line below. 163 164.. code-block:: bash 165 166 ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="000c", MODE="660", GROUP="plugdev", TAG+="uaccess" 167 168This example is valid for the case that the user joins to ``plugdev`` groups. 169 170The Raspberry Pi Pico, and thus the W55500 Evaluation Board, has an SWD 171interface that can be used to program and debug the on board RP2040. This 172interface can be utilized by OpenOCD. To use it with the RP2040, OpenOCD 173version 0.12.0 or later is needed. 174 175If you are using a Debian based system (including RaspberryPi OS, Ubuntu. and 176more), using the `pico_setup.sh`_ script is a convenient way to set up the 177forked version of OpenOCD. 178 179Depending on the interface used (such as JLink), you might need to 180checkout to a branch that supports this interface, before proceeding. 181Build and install OpenOCD as described in the README. 182 183Here is an example of building and flashing the :zephyr:code-sample:`blinky` 184application. 185 186.. zephyr-app-commands:: 187 :zephyr-app: samples/basic/blinky 188 :board: w5500_evb_pico 189 :goals: build flash 190 :gen-args: -DOPENOCD=/usr/local/bin/openocd -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts -DRPI_PICO_DEBUG_ADAPTER=picoprobe 191 192Set the environment variables **OPENOCD** to :file:`/usr/local/bin/openocd` and 193**OPENOCD_DEFAULT_PATH** to :file:`/usr/local/share/openocd/scripts`. This should 194work with the OpenOCD that was installed with the default configuration. This 195configuration also works with an environment that is set up by the 196`pico_setup.sh`_ script. 197 198**RPI_PICO_DEBUG_ADAPTER** specifies what debug adapter is used for debugging. 199 200If **RPI_PICO_DEBUG_ADAPTER** was not assigned, ``picoprobe`` is used by default. 201The other supported adapters are ``raspberrypi-swd``, ``jlink`` and 202``blackmagicprobe``. How to connect ``picoprobe`` and ``raspberrypi-swd`` is 203described in `Getting Started with Raspberry Pi Pico`_. Any other SWD debug 204adapter maybe also work with this configuration. 205 206The value of **RPI_PICO_DEBUG_ADAPTER** is cached, so it can be omitted from 207``west flash`` and ``west debug`` if it was previously set while running 208``west build``. 209 210**RPI_PICO_DEBUG_ADAPTER** is used in an argument to OpenOCD as 211``"source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]"``. Thus, 212**RPI_PICO_DEBUG_ADAPTER** needs to be assigned the file name of the debug 213adapter. 214 215You can also flash the board with the following 216command that directly calls OpenOCD (assuming a SEGGER JLink adapter is used): 217 218.. code-block:: console 219 220 $ 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' 221 222Using UF2 223--------- 224 225If you don't have an SWD adapter, you can flash the Raspberry Pi Pico with 226a UF2 file. By default, building an app for this board will generate a 227:file:`build/zephyr/zephyr.uf2` file. If the Pico is powered on with the ``BOOTSEL`` 228button pressed, it will appear on the host as a mass storage device. The 229UF2 file should be drag-and-dropped to the device, which will flash the Pico. 230 231Debugging 232========= 233 234The SWD interface can also be used to debug the board. To achieve this, you can 235either use SEGGER JLink or OpenOCD. 236 237Using SEGGER JLink 238------------------ 239 240Use a SEGGER JLink debug probe and follow the instruction in 241:ref:`Building, Flashing and Debugging<west-debugging>`. 242 243 244Using OpenOCD 245------------- 246 247Install OpenOCD as described for flashing the board. 248 249Here is an example for debugging the :zephyr:code-sample:`blinky` application. 250 251.. zephyr-app-commands:: 252 :zephyr-app: samples/basic/blinky 253 :board: w5500_evb_pico 254 :maybe-skip-config: 255 :goals: debug 256 :gen-args: -DOPENOCD=/usr/local/bin/openocd -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts -DRPI_PICO_DEBUG_ADAPTER=raspberrypi-swd 257 258As with flashing, you can specify the debug adapter by specifying 259**RPI_PICO_DEBUG_ADAPTER** at ``west build`` time. No needs to specify it at 260``west debug`` time. 261 262You can also debug with OpenOCD and gdb launching from command-line. 263Run the following command: 264 265.. code-block:: console 266 267 $ openocd -f interface/jlink.cfg -c 'transport select swd' -f target/rp2040.cfg -c "adapter speed 2000" -c 'targets rp2040.core0' 268 269On another terminal, run: 270 271.. code-block:: console 272 273 $ gdb-multiarch 274 275Inside gdb, run: 276 277.. code-block:: console 278 279 (gdb) tar ext :3333 280 (gdb) file path/to/zephyr.elf 281 282You can then start debugging the board. 283 284.. target-notes:: 285 286.. _pico_setup.sh: 287 https://raw.githubusercontent.com/raspberrypi/pico-setup/master/pico_setup.sh 288 289.. _Getting Started with Raspberry Pi Pico: 290 https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf 291 292.. _W55500 Evaluation Board Documentation: 293 https://docs.wiznet.io/Product/iEthernet/W5500/w5500-evb-pico 294