Radxa E20C: Easiest way to change UART baudrate?

Hi.

I've got a bit unusual issue. I bought one of those Radxa E20C mini-routers to use as a VPN gateway, and I'm having some trouble operating it. I wanted to disable any remote admin functionality over the ethernet ports, and instead use the debug serial UART link to get a terminal. Unfortunately, the link has proven to be very unstable. When printing large amount of text, the output is often mutilated garbage with large parts of text randomly missing or intermixed. It would seem the serial link is dropping some characters because the baudrate is too high. The device comes with one of those WCH CH340 serial chips, which is known to have problems at maximum advertised speeds (1500000). Manually changing the baud via terminal to something lower like 115200 completely eliminates the issue.

Unfortunately, this is only a temporary solution because each reboot will reset the baudrate back to its default. I could not find any easy way to permanently set the baudrate to 115200. While the uboot does allow changing the baud by using the "setenv" command, it doesn't support the "saveenv" command. The kernel will also switch back to 1500000 upon booting, so the baud rate must apparently be set in two different places - kernel and uboot. I tried editing the kernel command line in the boot.scr file on the first eMMC partition, and the system then failed to boot with some CRC error.

Original boot.scr:
setenv bootargs "console=${serial_port},1500000 earlycon=uart8250,mmio32${serial_addr} root=PARTUUID=${uuid} rw rootwait";
Changed to:
setenv bootargs "console=${serial_port},115200 earlycon=uart8250,mmio32${serial_addr} root=PARTUUID=${uuid} rw rootwait";

What would be the easiest way to permanently set the serial baud rate to 115200 (uboot + kernel)? Can someone point me in the right direction? Is recompiling the entire image from scratch the only option?

Thanks in advance.

I think this is in the DTS, which can come from u-boot and/or the kernel.

Are you sure the problem is on the e20c side and not the serial adapter you use on the other side ? (I ask because I've also got an e20c and since I switched to another USB-serial chip, one that handles 1.5Mbauds properly, I never saw a problem with the console output)

Serial adapter? I only use a USB cable to connect one USB port on E20C to another on a laptop or a desktop PC. The UART serial chip is inside E20C. Then the "screen" program is used on /dev/ttyUSB0 with appropriate baud rate. Lowering the baud rate solves the issue. Or did you mean something else?

Argh, yes sorry, I mixed with another SBC... :sleeping_face: not enough coffee yet