Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8041

Zephyr • Re: Serial echo sample on Pico2

$
0
0
The one thing I've learnt about Zephyr-RTOS is that it will force you to learn the board definition files (i.e. device tree source and include files as typically found in the boards directory). It will also prompt you to get to know the pinctrl header file (https://docs.zephyrproject.org/apidoc/l ... ource.html).

Then the part I tend to forget about is the peripheral definitions at the soc level (i.e. rp2040.dtsi and rp2350.dtsi files, which are in a different folder altogether). Here you will find that uart1 is defined but it is disabled by default:

Code:

uart1: uart@40038000 {compatible = "raspberrypi,pico-uart", "arm,pl011";reg = <0x40038000 DT_SIZE_K(4)>;clocks = <&clocks RPI_PICO_CLKID_CLK_PERI>;resets = <&reset RPI_PICO_RESETS_RESET_UART1>;interrupts = <21 RPI_PICO_DEFAULT_IRQ_PRIORITY>;interrupt-names = "uart1";status = "disabled";};
So, yes, you need to create a specific overlay file for the Pico2 - to at least enable uart1. Something like this will work, which assumes uart0 is kept as P0 and P1:

Code:

/* The Pico and Pico 2 are pin compatible. */&pinctrl {uart1_default: uart1_default {group1 {pinmux = <UART1_TX_P4>;};group2 {pinmux = <UART1_RX_P5>;input-enable;};};};&i2c0 {status = "disabled";};&uart1 {current-speed = <115200>;status = "okay";pinctrl-0 = <&uart1_default>;pinctrl-names = "default";};/ {chosen {uart,passthrough = &uart1;};};

Statistics: Posted by gerrikoio — Thu Sep 25, 2025 10:19 pm



Viewing all articles
Browse latest Browse all 8041

Trending Articles