I’m in the process of moving my project from Torizon OS to a Yocto build. I have a Python application that talks to a peripheral using /dev/verdin-uart
. On Torizon OS, I ran a docker container for this application and passed the device to the container using these lines in a docker-compose file
devices:
- /dev/verdin-uart1:/dev/verdin-uart1
I use the pyserial library to initialize communication.
serial.Serial(port="/dev/verdin-uart1", baudrate=9600)
Using this configuration, I was able to send and receive messages over uart1. However, on Yocto, using the same application source code, I can’t send/receive messages.
I thought it might be an issue with default port settings, but they appear the same between torizon
root@verdin-am62-15207092:~# stty -F /dev/verdin-uart1 -g
0:0:cbd:0:3:1c:7f:15:4:0:0:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
and yocto
root@verdin-am62:~# stty -F /dev/verdin-uart1 -g
0:0:cbd:0:3:1c:7f:15:4:0:0:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
I also thought it could be a device tree issue, so I generated a device tree from each using this command
dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree
Initially, there was a difference. On my module running torizon OS, the u-boot variable fdtfile
was set to k3-am625-verdin-wifi-dev.dtb
, and there was no reference to rs485
serial@2810000 {
clock-names = "fclk";
interrupts = <0x00 0xb3 0x04>;
compatible = "ti,am64-uart\0ti,am654-uart";
power-domains = <0x03 0x98 0x01>;
reg = <0x00 0x2810000 0x00 0x100>;
phandle = <0xac>;
pinctrl-names = "default";
status = "okay";
pinctrl-0 = <0x19>;
clocks = <0x02 0x98 0x00>;
};
While on the yocto build, there were 2 extra parameters related to rs485 (which I do not want for my application). The fdtfile was also set to ‘k3-am625-verdin-wifi-dev.dtb’
serial@2810000 {
power-domains = <0x03 0x98 0x01>;
pinctrl-names = "default";
rs485-rx-during-tx;
pinctrl-0 = <0x19>;
clock-names = "fclk";
interrupts = <0x00 0xb3 0x04>;
clocks = <0x02 0x98 0x00>;
linux,rs485-enabled-at-boot-time;
compatible = "ti,am64-uart\0ti,am654-uart";
status = "okay";
reg = <0x00 0x2810000 0x00 0x100>;
phandle = <0xac>;
};
However, I changed fdtfile
to k3-am625-verdin-wifi-dahlia.dtb
(which is what I actually want to use) on the yocto module, and now its entry for serial@2810000 looks the same as that of the one running torizon OS. But that doesn’t fix the problem.
I also verified that both modules have the same symlink for /dev/verdin-uart1
, and that they are being assigned to the same serial ports during boot
root@verdin-am62-15207092:~# ls -al /dev/verdin-uart*
lrwxrwxrwx 1 root root 5 Sep 6 20:47 /dev/verdin-uart1 -> ttyS0
lrwxrwxrwx 1 root root 5 Sep 6 20:47 /dev/verdin-uart2 -> ttyS1
lrwxrwxrwx 1 root root 5 Sep 6 20:47 /dev/verdin-uart3 -> ttyS2
lrwxrwxrwx 1 root root 5 Sep 6 20:47 /dev/verdin-uart4 -> ttyS3
root@verdin-am62-15207092:~# dmesg | grep ttyS
[ 1.217772] 4a00000.serial: ttyS3 at MMIO 0x4a00000 (irq = 289, base_baud = 3000000) is a 8250
[ 1.219262] 2800000.serial: ttyS2 at MMIO 0x2800000 (irq = 290, base_baud = 3000000) is a 8250
[ 1.226522] printk: console [ttyS2] enabled
[ 1.228400] 2810000.serial: ttyS0 at MMIO 0x2810000 (irq = 291, base_baud = 3000000) is a 8250
[ 1.229896] 2850000.serial: ttyS4 at MMIO 0x2850000 (irq = 292, base_baud = 3000000) is a 8250
The 2 modules are running a slightly different version of linux, but I don’t think that should matter…
torizon os:
root@verdin-am62-15207092:~# uname -a
Linux verdin-am62-15207092 6.1.46-6.5.0+git.8e6a2ddd4fe6 #1-TorizonCore SMP PREEMPT Thu Dec 21 17:08:38 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
yocto:
root@verdin-am62:~# uname -a
Linux verdin-am62 6.1.80+git.0d9f1748ac17 #1 SMP PREEMPT Thu Mar 28 13:48:11 UTC 2024 aarch64 GNU/Linux
I can’t think of any other possible differences in configuration between the modules, other than that obviously one is running docker and the other is running just on linux. Are there any other types of configuration I should be aware of for this uart interface? Or anything else I should explicitly include in my Yocto build to allow this to work?