Uart1 & 2 as debug console

Hi my last post of the year with a question

I want to have uart1 or uart2 as console

I changed the u-boot + kernel to use uart1/serial1 by changing the dts

added uart1 pins and updated the serial1 adding these (mt7998a.dtsi) and on the bpi-r4 dtsi changed the stdout to serial1 and added status okay for serial1

created the bl2 + fip, compiled kernel and buildimg but nothing shows on the console after these changes

i checked both uart1 + uart2 have current so they are live but no traffic . What am I missing ? if for some reason serial0 is blown isn’t there any way to have another console?

Afaik the early bootstage is only printed on debug-uart. I did some tests on R3 adding second uart for a logger-circuit with only partial success…one issue i faced was the speed cannot be set via cmdline,only at userspace.

https://wiki.fw-web.de/doku.php?id=en:bpi-r3:gpio#uart

Maybe it helps a bit. Also wishing you a happy new year.

2 Likes

thank you and happy new year as well.

I noticed i missed changing the uart base address to serial1 (0x11000100)for u-boot config

still doesn’t work with anything i tried … uart2 & uart1 have both the right voltage etc … but still nothing

any ideas @sinovoip & mediatek … have you done any tests with uart1 or uart2 ?

Have you tried with reduced speed of 9600 baud on your client? At least the output have to be mapped to the other uart which may work for uboot and linux but not bootrom.

i did with no luck … I measured the uart2 voltage and there is about 3.3v and on rx/tx if I do an echo to /dev/ttyS2 is see the traffic counters incrementing

the tests were on the mtk-sdk though

why bootrom should not work ?

Bootrom is not changable only beginning on bl2 can be changed in software

noted that the serial1 and serial2 don’t have pinctrl-0 defined … also UART1 and UART2 are four pins RX/TX/CTS/RTS

do any of the above will be an issue

Possibly you needs pinctrlnaetting,not sure currently for r3…afair have tested additional uart on r3 only.

ok … i made some progress at least … will look into the pinctrl-0

Are you still on ttyS0?

Remember speed-setting was not working on my tests trying same on R3…uart1/2 were always at 9600 baud till i changed in userspace.(cmdlije was not enough to set speed).

no on ttyS2

root@bpi-r4:/sys# cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:ST16650V2 mmio:0x11000000 irq:99 tx:0 rx:0 CTS|DSR|CD|RI
1: uart:ST16650V2 mmio:0x11000100 irq:100 tx:0 rx:0 DSR|CD|RI
2: uart:ST16650V2 mmio:0x11000200 irq:101 tx:11488 rx:0 RTS|DTR|DSR|CD|RI

you can see above I have traffic but nothing shows on the

But uart2 works so far as far as i see…which speed?

i am at 115200 … but still nothing shows which is weird… I also enabled the pins … here’s a snippet of the dtsi


	uart2_3_pins: uart2-3-pins {
		mux {
			function = "uart";
			groups = "uart2_3";
		};
	};
};

&pwm {
	status = "okay";
};

&serial0 {
	status = "okay";
};
&serial1 {
	status = "okay";
};
&serial2 {
	pinctrl-names = "default";
	pinctrl-0 = <&uart2_3_pins>;
	status = "okay";
};

Uart1 is 80/81 and so uart1_2_lite group

Uart2 is 58/59 based on schematic,but i see no such lite definition in pinctrl…2_3 adds gpio 60+61,maybe these pins are blocked,but this should result in probe fail

Maybe define 2_3_lite like this

static const int mt7988_uart2_3_lite_pins[] = { 58, 59 };
static int mt7988_uart2_3_lite_funcs[] = { 3, 3 };

PINCTRL_PIN_GROUP("uart2_3_lite", mt7988_uart2_3_lite),

this seemed to have done the trick RX counters now increasing

but still nothing on the console

I tried to short UART2_TX & RX while doing a cat on /dev/ttyS2 and nothing showed up! … the only way I can get the RX counters to increment is by forcing a local echo on Putty

it may be perhaps a problem with my board … are you able to test with yours ?

Afaik for cat you have to set the speed too…maybe system have not completely set speed aettings…try to set speed like i did in wiki above before sending receive…and if you send you should see it in console too,when running cat in background

yes i tried what you have on the wiki but still nothing…

root@bpi-r3:~# stty -F /dev/ttyS1 115200 cs8 -cstopb -parenb
root@bpi-r3:~# echo “TEST” > /dev/ttyS1 root@bpi-r3:~# dmesg --follow > /dev/ttyS1 &

replacing the above with ttyS2