Zephyr: Missing USART4 definition in .dtsi files of the STM32U0

 Date: January 23, 2025

I started playing around with Zephyr for the first time and found some problem while integrating the board package of my SolarLoRaBox.

It turns out that implementation of the ST STM32U083CCT6 is missing the definition of USART4 in the .dtsi-files.

GitHub Bug report und pull request was filled here.

A quick workaround is to add it manually to the .dts of the board:

    soc {
		usart4: serial@40004c00 {
			pinctrl-0 = <&usart4_tx_pa0 &usart4_rx_pa1>;
        	pinctrl-names = "default";
        	current-speed = <115200>;
        	status = "okay";
			compatible = "st,stm32-usart", "st,stm32-uart";
			reg = <0x40004c00 0x400>;
			clocks = <&rcc STM32_CLOCK(APB1, 19U)>;
			resets = <&rctl STM32_RESET(APB1L, 19U)>;
			interrupts = <30 0>;
		};

Which then looks in full like

/ {
	model = "SolarLoraBox";
	compatible = "st,stm32u083c-dk";

	#address-cells = <1>;
	#size-cells = <1>;

	chosen {
		zephyr,console = &usart4;
		zephyr,shell-uart = &usart4;
		zephyr,sram = &sram0;
		zephyr,flash = &flash0;
	};

	leds: leds {
		compatible = "gpio-leds";
		green_led_1: led_3 {
			gpios = <&gpioa 10 GPIO_ACTIVE_HIGH>;
			label = "User LED";
		};
	};

	aliases {
		led0 = &green_led_1;
	};
    soc {
		usart4: serial@40004C00 {
			pinctrl-0 = <&usart4_tx_pa0 &usart4_rx_pa1>;
        	pinctrl-names = "default";
        	current-speed = <115200>;

			compatible = "st,stm32-usart", "st,stm32-uart";
			reg = <0x40004C00 0x400>;
			clocks = <&rcc STM32_CLOCK(APB1, 19U)>;
			resets = <&rctl STM32_RESET(APB1L, 19U)>;
			interrupts = <30 0>;
        	status = "okay";
		};
    };
};

Voilà, printf works again.


Previous
⏪ Datamining Meshtastic - Statistics of a small sized network in Southern Germany

Next
Zephyr: Integrating a ST STM32U083 and a Semtech SX1262 into a LoRaWAN network (The Thing Network) ⏩