Raspberry Pi Pico and Pico W
Overview
This is a set of Bridle’s extension to the original Zephyr upstream board Raspberry Pi Pico with some adaptions and improvement on Kconfig and Devicetree level.
List of extensions
Kconfig
deactivate self powered USB explicitly and set the maximum of electrical current consumption to 500㎃:
Raspberry Pi Pico and Pico W
Kconfig.defconfigconfig USB_SELF_POWERED default n depends on USB_DEVICE_STACK && BOARD_RPI_PICO config USB_MAX_POWER default 250 if BOARD_RPI_PICO # 500mA depends on USB_DEVICE_STACK && BOARD_RPI_PICO
change log level and startup delay only in case of use the native USB device port
raspberrypi,pico-usbd
with CDC-ACM UARTzephyr,cdc-acm-uart
as Zephyr console:CONFIG_USB_CDC_ACM_LOG_LEVEL_CHOICE
:=CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF
CONFIG_USB_DEVICE_LOG_LEVEL_CHOICE
:=CONFIG_USB_DEVICE_LOG_LEVEL_ERR
Raspberry Pi Pico and Pico W
Kconfig.defconfig# Workaround for not being able to have commas in macro arguments DT_CHOSEN_Z_CONSOLE := zephyr,console DT_COMPAT_Z_CDC_ACM_UART := zephyr,cdc-acm-uart DT_COMPAT_RPIPICO_USB := raspberrypi,pico-usbd # Macros to shorten Kconfig expressions DT_CHOSEN_CONSOLE_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_CONSOLE)) DT_CHOSEN_CONSOLE_PARENT := $(dt_node_parent,$(DT_CHOSEN_CONSOLE_NODE)) if BOARD_RPI_PICO && \ $(dt_chosen_enabled,$(DT_CHOSEN_Z_CONSOLE)) && \ $(dt_compat_on_bus,$(DT_COMPAT_Z_CDC_ACM_UART),usb) && \ $(dt_node_has_compat,$(DT_CHOSEN_CONSOLE_PARENT),$(DT_COMPAT_RPIPICO_USB)) # Logger cannot use itself to log choice USB_CDC_ACM_LOG_LEVEL_CHOICE default USB_CDC_ACM_LOG_LEVEL_OFF depends on LOG endchoice # Set USB log level to error only choice USB_DEVICE_LOG_LEVEL_CHOICE default USB_DEVICE_LOG_LEVEL_ERR depends on LOG endchoice # Wait 4000ms at startup for logging config LOG_PROCESS_THREAD_STARTUP_DELAY_MS default 4000 depends on LOG # Wait 4000ms at startup for USB enumeration on host side config BOOT_DELAY default 4000 endif # zephyr,cdc-acm-uart
Devicetree
set default entries for
model
andcompatible
of the boards:Raspberry Pi Pico
rpi_pico.overlay/ { model = "Raspberry Pi Pico @ UART Concole"; compatible = "raspberrypi,rpi-pico", "raspberrypi,rpi-pico-uartcons"; };
Raspberry Pi Pico W
rpi_pico_w.overlay/ { model = "Raspberry Pi Pico W @ UART Concole"; compatible = "raspberrypi,rpi-pico-w", "raspberrypi,rpi-pico-w-uartcons"; };
add the Bridle specific edge connecor binding
raspberrypi,pico-header-r3
Raspberry Pi Pico and Pico W
rpipico_r3_connector.dtsi/ { rpipico_header: connector { compatible = "raspberrypi,pico-header-r3"; #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 */ <23 0 &gpio0 26 0>, /* ADC0 / GP26 */ <24 0 &gpio0 27 0>, /* ADC1 / GP27 */ <25 0 &gpio0 28 0>; /* ADC2 / GP28 */ }; };
add the Bridle specific interface labels:
rpipico_serial: &pico_serial {};
rpipico_spi: &pico_spi {};
rpipico_spi0: &pico_spi0 {};
rpipico_spi1: &pico_spi1 {};
rpipico_i2c: &pico_i2c {};
rpipico_i2c0: &pico_i2c0 {};
rpipico_i2c1: &pico_i2c1 {};
enable the RP2040 SoC reset controller bindet as
raspberrypi,pico-reset
Raspberry Pi Pico and Pico W
rpipico_r3.dtsi&reset { status = "okay"; };
prepare the RP2040 SoC SPI1 controller bindet as
raspberrypi,pico-spi
with defaultraspberrypi,pico-pinctrl
andclock-frequency = <DT_FREQ_M(8)>;
properties, but explicitly set this to disabled statusRaspberry Pi Pico and Pico W
rpipico_r3-spi1.dtsi&spi1 { status = "disabled"; pinctrl-0 = <&spi1_default>; pinctrl-names = "default"; clock-frequency = <DT_FREQ_M(8)>; };
rpipico_r3-pinctrl.dtsi&pinctrl { spi1_default: spi1_default { group1 { pinmux = <SPI1_CSN_P9>, <SPI1_SCK_P10>, <SPI1_TX_P11>; }; group2 { pinmux = <SPI1_RX_P12>; input-enable; }; }; };