diff --git a/boards/wiznet/w5500_evb_pico/board.yml b/boards/wiznet/w5500_evb_pico/board.yml index eb4eed60b88b..e80be185286f 100644 --- a/boards/wiznet/w5500_evb_pico/board.yml +++ b/boards/wiznet/w5500_evb_pico/board.yml @@ -1,6 +1,6 @@ board: name: w5500_evb_pico - full_name: W5500 Evaluation Pico + full_name: W5500-EVB-Pico vendor: wiznet socs: - name: rp2040 diff --git a/boards/wiznet/w5500_evb_pico2/Kconfig.defconfig b/boards/wiznet/w5500_evb_pico2/Kconfig.defconfig new file mode 100644 index 000000000000..1af3e24b6f08 --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/Kconfig.defconfig @@ -0,0 +1,19 @@ +# Copyright (c) 2025 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_W5500_EVB_PICO2 + +if NETWORKING + +config NET_L2_ETHERNET + default y + +endif # NETWORKING + +config USB_SELF_POWERED + default n + +config SYS_CLOCK_HW_CYCLES_PER_SEC + default 150000000 + +endif # BOARD_W5500_EVB_PICO2 diff --git a/boards/wiznet/w5500_evb_pico2/Kconfig.w5500_evb_pico2 b/boards/wiznet/w5500_evb_pico2/Kconfig.w5500_evb_pico2 new file mode 100644 index 000000000000..ef3da1e97c30 --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/Kconfig.w5500_evb_pico2 @@ -0,0 +1,5 @@ +# Copyright (c) 2025 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_W5500_EVB_PICO2 + select SOC_RP2350A_M33 if BOARD_W5500_EVB_PICO2_RP2350A_M33 diff --git a/boards/wiznet/w5500_evb_pico2/board.cmake b/boards/wiznet/w5500_evb_pico2/board.cmake new file mode 100644 index 000000000000..feae063129ac --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/board.cmake @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: Apache-2.0 + +if("${RPI_PICO_DEBUG_ADAPTER}" STREQUAL "") + set(RPI_PICO_DEBUG_ADAPTER "cmsis-dap") +endif() + +board_runner_args(openocd --cmd-pre-init "source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]") +board_runner_args(openocd --cmd-pre-init "source [find target/rp2350.cfg]") + +# The adapter speed is expected to be set by interface configuration. +# The Raspberry Pi's OpenOCD fork doesn't, so match their documentation at +# https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html#debugging-with-swd +board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 5000") + +board_runner_args(uf2 "--board-id=RP2350") + +include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) diff --git a/boards/wiznet/w5500_evb_pico2/board.yml b/boards/wiznet/w5500_evb_pico2/board.yml new file mode 100644 index 000000000000..61a534601dc3 --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/board.yml @@ -0,0 +1,6 @@ +board: + name: w5500_evb_pico2 + full_name: W5500-EVB-Pico2 + vendor: wiznet + socs: + - name: rp2350a diff --git a/boards/wiznet/w5500_evb_pico2/doc/img/w5500_evb_pico2.webp b/boards/wiznet/w5500_evb_pico2/doc/img/w5500_evb_pico2.webp new file mode 100644 index 000000000000..cd0ced64165d Binary files /dev/null and b/boards/wiznet/w5500_evb_pico2/doc/img/w5500_evb_pico2.webp differ diff --git a/boards/wiznet/w5500_evb_pico2/doc/index.rst b/boards/wiznet/w5500_evb_pico2/doc/index.rst new file mode 100644 index 000000000000..d1aefc4e9f73 --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/doc/index.rst @@ -0,0 +1,136 @@ +.. zephyr:board:: w5500_evb_pico2 + +Overview +******** + +W5500-EVB-Pico2 is a microcontroller evaluation board based on the Raspberry +Pi RP2350A and fully hardwired TCP/IP controller W5500 - and basically works +the same as Raspberry Pi Pico2 board but with additional Ethernet via W5500. +The USB bootloader allows the ability to flash without any adapter, in a +drag-and-drop manner. It is also possible to flash and debug the boards with +their SWD interface, using an external adapter. + +Hardware +******** + +- Dual core Arm Cortex-M33 or Hazard3 processor running up to 133MHz +- 520KB on-chip SRAM +- 16MB on-board QSPI flash with XIP capabilities +- 26 GPIO pins +- 3 Analog inputs +- 2 UART peripherals +- 2 SPI controllers +- 2 I2C controllers +- 16 PWM channels +- USB 1.1 controller (host/device) +- 3 Programmable I/O (PIO) for custom peripherals +- On-board LED +- 1 Watchdog timer peripheral +- Wiznet W5500 Ethernet MAC/PHY + +Supported Features +================== + +.. zephyr:board-supported-hw:: + +Pin Mapping +=========== + +The peripherals of the RP2350A SoC can be routed to various pins on the board. +The configuration of these routes can be modified through DTS. Please refer to +the datasheet to see the possible routings for each peripheral. + +External pin mapping on the W5500_EVB_PICO2 is identical to the Raspberry Pi +Pico2. Since GPIO 25 is routed to the on-board LED on, similar to the Raspberry +Pi Pico, the blinky example works as intended. The W5500 is routed to the SPI0 +(P16-P19), with the reset and interrupt signal for the W5500 routed to P20 and +P21, respectively. All of these are shared with the edge connector on the +board. + +Refer to `W55500 Evaluation Board Pico2 Documentation`_ for a board schematic and +other certifications. + +Default Zephyr Peripheral Mapping: +---------------------------------- + +.. rst-class:: rst-columns + +- UART0_TX : P0 +- UART0_RX : P1 +- I2C0_SDA : P4 +- I2C0_SCL : P5 +- I2C1_SDA : P14 +- I2C1_SCL : P15 +- SPI0_RX : P16 +- SPI0_CSN : P17 +- SPI0_SCK : P18 +- SPI0_TX : P19 +- W5500 Reset : P20 +- W5500 Interrupt : P21 +- ADC_CH0 : P26 +- ADC_CH1 : P27 +- ADC_CH2 : P28 +- ADC_CH3 : P29 + +Programming and Debugging +************************* + +Flashing +======== + +Using OpenOCD +------------- + +The overall explanation regarding flashing and debugging is the same as or +``rpi_pico``. +See :ref:`rpi_pico_flashing_using_openocd`. in ``rpi_pico`` documentation. + +A typical build command for w5500_evb_pico2 is as follows. +This assumes a CMSIS-DAP adapter such as the RaspberryPi Debug Probe, +but if you are using something else, specify ``RPI_PICO_DEBUG_ADAPTER``. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: w5500_evb_pico2 + :goals: build flash + :gen-args: -DOPENOCD=/usr/local/bin/openocd + +Using UF2 +--------- + +If you don't have an SWD adapter, you can flash the Raspberry Pi Pico with +a UF2 file. By default, building an app for this board will generate a +:file:`build/zephyr/zephyr.uf2` file. If the Pico is powered on with the ``BOOTSEL`` +button pressed, it will appear on the host as a mass storage device. The +UF2 file should be drag-and-dropped to the device, which will flash the Pico. + +Debugging +========= + +The SWD interface can also be used to debug the board. To achieve this, you can +either use SEGGER JLink or OpenOCD. + +Using OpenOCD +------------- + +Install OpenOCD as described for flashing the board. + +Here is an example for debugging the :zephyr:code-sample:`blinky` application. + +.. zephyr-app-commands:: + :zephyr-app: samples/basic/blinky + :board: w5500_evb_pico2 + :maybe-skip-config: + :goals: debug + :gen-args: -DOPENOCD=/usr/local/bin/openocd + +.. target-notes:: + +.. _pico_setup.sh: + https://raw.githubusercontent.com/raspberrypi/pico-setup/master/pico_setup.sh + +.. _Getting Started with Raspberry Pi Pico: + https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf + +.. _W55500 Evaluation Board Pico2 Documentation: + https://docs.wiznet.io/Product/iEthernet/W5500/w5500-evb-pico2 diff --git a/boards/wiznet/w5500_evb_pico2/support/openocd.cfg b/boards/wiznet/w5500_evb_pico2/support/openocd.cfg new file mode 100644 index 000000000000..0f833247bc60 --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/support/openocd.cfg @@ -0,0 +1,11 @@ +# Copyright (c) 2025 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +# Checking and set 'adapter speed'. +# Set the adaptor speed, if unset, and given as an argument. +proc set_adapter_speed_if_not_set { speed } { + puts "checking adapter speed..." + if { [catch {adapter speed} ret] } { + adapter speed $speed + } +} diff --git a/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2-pinctrl.dtsi b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2-pinctrl.dtsi new file mode 100644 index 000000000000..dffd24d8aeaa --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2-pinctrl.dtsi @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2021, Yonatan Schachter + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart0_default: uart0_default { + group1 { + pinmux = ; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; + + i2c0_default: i2c0_default { + group1 { + pinmux = , ; + input-enable; + input-schmitt-enable; + }; + }; + + i2c1_default: i2c1_default { + group1 { + pinmux = , ; + input-enable; + input-schmitt-enable; + }; + }; + + spi0_default: spi0_default { + group1 { + pinmux = , , ; + }; + + group2 { + pinmux = ; + input-enable; + }; + }; + + pwm_ch4b_default: pwm_ch4b_default { + group1 { + pinmux = ; + }; + }; + + adc_default: adc_default { + group1 { + pinmux = , , , ; + input-enable; + }; + }; +}; diff --git a/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2.dtsi b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2.dtsi new file mode 100644 index 000000000000..5a0959d721e6 --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2.dtsi @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2025 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include +#include + +#include "w5500_evb_pico2-pinctrl.dtsi" + +/ { + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,code-partition = &code_partition; + }; + + pico_header: connector { + compatible = "raspberrypi,pico-header"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &gpio0 0 0>, /* GP0 */ + <1 0 &gpio0 1 0>, /* GP1 */ + <2 0 &gpio0 2 0>, /* GP2 */ + <3 0 &gpio0 3 0>, /* GP3 */ + <4 0 &gpio0 4 0>, /* GP4 */ + <5 0 &gpio0 5 0>, /* GP5 */ + <6 0 &gpio0 6 0>, /* GP6 */ + <7 0 &gpio0 7 0>, /* GP7 */ + <8 0 &gpio0 8 0>, /* GP8 */ + <9 0 &gpio0 9 0>, /* GP9 */ + <10 0 &gpio0 10 0>, /* GP10 */ + <11 0 &gpio0 11 0>, /* GP11 */ + <12 0 &gpio0 12 0>, /* GP12 */ + <13 0 &gpio0 13 0>, /* GP13 */ + <14 0 &gpio0 14 0>, /* GP14 */ + <15 0 &gpio0 15 0>, /* GP15 */ + <16 0 &gpio0 16 0>, /* GP16 */ + <17 0 &gpio0 17 0>, /* GP17 */ + <18 0 &gpio0 18 0>, /* GP18 */ + <19 0 &gpio0 19 0>, /* GP19 */ + <20 0 &gpio0 20 0>, /* GP20 */ + <21 0 &gpio0 21 0>, /* GP21 */ + <22 0 &gpio0 22 0>, /* GP22 */ + <26 0 &gpio0 26 0>, /* GP26 */ + <27 0 &gpio0 27 0>, /* GP27 */ + <28 0 &gpio0 28 0>; /* GP28 */ + }; + + leds { + compatible = "gpio-leds"; + + led0: led_0 { + gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; + label = "LED"; + }; + }; + + pwm_leds { + compatible = "pwm-leds"; + status = "disabled"; + + pwm_led0: pwm_led_0 { + pwms = <&pwm 9 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + label = "PWM_LED"; + }; + }; + + aliases { + led0 = &led0; + pwm-led0 = &pwm_led0; + watchdog0 = &wdt0; + }; +}; + +&flash0 { + /* 16MB of flash minus the 0x100 used for + * the second stage bootloader + */ + reg = <0x10000000 DT_SIZE_M(16)>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* Reserved memory for the second stage bootloader */ + second_stage_bootloader: partition@0 { + label = "second_stage_bootloader"; + reg = <0x00000000 0x100>; + read-only; + }; + + /* + * Usable flash. Starts at 0x100, after the bootloader. The partition + * size is 16MB minus the 0x100 bytes taken by the bootloader. + */ + code_partition: partition@100 { + label = "code-partition"; + reg = <0x100 (DT_SIZE_M(16) - 0x100)>; + read-only; + }; + }; +}; + +&uart0 { + current-speed = <115200>; + status = "okay"; + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + clock-frequency = ; + status = "okay"; + pinctrl-0 = <&spi0_default>; + pinctrl-names = "default"; + cs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; + + ethernet: w5500@0 { + compatible = "wiznet,w5500"; + reg = <0x0>; + spi-max-frequency = <50000000>; + int-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; + reset-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + local-mac-address = [00 00 00 01 02 03]; + status = "okay"; + }; +}; + +&i2c0 { + clock-frequency = ; + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; + status = "okay"; +}; + +&adc { + pinctrl-0 = <&adc_default>; + pinctrl-names = "default"; + status = "okay"; +}; + +&pwm { + pinctrl-0 = <&pwm_ch4b_default>; + pinctrl-names = "default"; + divider-int-0 = <255>; +}; + +&timer0 { + status = "okay"; +}; + +&wdt0 { + status = "okay"; +}; + +zephyr_udc0: &usbd { + status = "okay"; +}; + +pico_spi: &spi0 {}; +pico_i2c0: &i2c0 {}; +pico_i2c1: &i2c1 {}; +pico_serial: &uart0 {}; diff --git a/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2_rp2350a_m33.dts b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2_rp2350a_m33.dts new file mode 100644 index 000000000000..88ba8a6d16c4 --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2_rp2350a_m33.dts @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2025 TOKITA Hiroshi + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include "w5500_evb_pico2.dtsi" diff --git a/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2_rp2350a_m33.yaml b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2_rp2350a_m33.yaml new file mode 100644 index 000000000000..aea485945f36 --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2_rp2350a_m33.yaml @@ -0,0 +1,21 @@ +identifier: w5500_evb_pico2/rp2350a/m33 +name: Wiznet W5500 Evaluation Board with RP2350 +type: mcu +arch: arm +flash: 16384 +ram: 520 +toolchain: + - zephyr + - gnuarmemb +supported: + - adc + - clock + - counter + - dma + - gpio + - hwinfo + - i2c + - pwm + - spi + - uart + - watchdog diff --git a/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2_rp2350a_m33_defconfig b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2_rp2350a_m33_defconfig new file mode 100644 index 000000000000..aaaa51cbdb98 --- /dev/null +++ b/boards/wiznet/w5500_evb_pico2/w5500_evb_pico2_rp2350a_m33_defconfig @@ -0,0 +1,10 @@ +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_GPIO=y +CONFIG_USE_DT_CODE_PARTITION=y +CONFIG_BUILD_OUTPUT_UF2=y +CONFIG_BUILD_OUTPUT_HEX=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_RESET=y +CONFIG_CLOCK_CONTROL=y diff --git a/tests/drivers/adc/adc_api/boards/w5500_evb_pico2_rp2350a_m33.overlay b/tests/drivers/adc/adc_api/boards/w5500_evb_pico2_rp2350a_m33.overlay new file mode 100644 index 000000000000..fb0ecaac606a --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/w5500_evb_pico2_rp2350a_m33.overlay @@ -0,0 +1,12 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2025 TOKITA Hiroshi + */ + +/* W5500 EVB Pico2 can work the same configuration as W5500 EVB Pico */ +#include "w5500_evb_pico.overlay" + +&adc { + status = "okay"; +};