This is similar to this question, but for different hardware and with some things already tried. My ultimate goal is to have bluetooth on UART0 and debug on UART2.
I use RPi 4B and need to redirect U-Boot console to UART2. My current setup:
I configured
force_eeprom_read=0
anddisable_poe_fan=1
in my config.txt as described here.For now I also have
dtoverlay=disable-bt
andenable_uart=1
in config.txt.I configured
dtoverlay=uart2
in my config.txtI prepared (and applied in config.txt) an overlay to pick uart2 in /chosen node:
/dts-v1/; /plugin/;
/{ compatible = "brcm,bcm2711";
fragment@0 { target-path = "/chosen"; __overlay__ { /* uart2 */ stdout-path = "serial@7e201400:115200n8"; }; };
};
When I boot the device in this configuration, U-Boot console still points to UART0.
In U-Boot prompt I check serial configuration using
coninfo
:U-Boot> coninfo List of available devices: serial@7e201000 00000007 IO serial 00000003 IO stdin stdout stderr
I can also investigate the /chosen node of device tree:
U-Boot> fdt addr ${fdt_addr} U-Boot> fdt list /chosen chosen { ranges; #size-cells = <0x00000001>; #address-cells = <0x00000001>; compatible = "simple_bus"; kaslr-seed = <0xb6f21e2c 0x0dbb17ef>; stdout-path = "serial@7e201400:115200n8"; rpi-boardrev-ext = <0x00000000>; bootargs = "..."; framebuffer@3eaf5000 { }; bootloader { }; };
The overlay applied correctly, as I now have stdout-path set to the desired UART.
Further investigating the device tree:
U-Boot> fdt list /soc/serial@7e201400 serial@7e201400 { pinctrl-0 = <0x000000a0>; pinctrl-names = "default"; compatible = "arm,pl011", "arm,primecell"; reg = <0x7e201400 0x00000200>; interrupts = <0x00000000 0x00000079 0x00000004>; clocks = <0x00000007 0x00000013 0x00000007 0x00000014>; clock-names = "uartclk", "apb_pclk"; arm,primecell-periphid = <0x00241011>; status = "okay"; phandle = <0x000000b2>; };
This shows that the uart2 overlay was applied correctly. However, this UART is not even shown in the coninfo list.
What do I miss here?
I found the first error: the stdout-path
should be defined as full path, like this: /soc/serial@7e201400:115200n8
.
However, when I fix this, the device does not boot at all. This is verified by the ACT LED not blinking and ethernet port LEDs not blinking.
When I disable my overlay that updates /chosen
by commenting it out in config.txt, the device boots normally.