Open Andrew-Wallace opened 4 years ago
@Andrew-Wallace thank you for letting us know, we'll look into this with high priority and get back to you as soon as possible
Hi @Andrew-Wallace ,
Currently I don't have an Orange Pi Zero to test on, as the Orange PI Zero is currently community supported.
However, I have an Orange Pi Lite v1 that I used for the purpose of this test. Please see below how I enabled uarts 1 and 2 on it. The procedure should be the pretty much the same on the Zero.
I've also released BalenaOS 2.45.1+rev1 for the Orange Pi Zero in the staging dashboard. Please try with this latest release, since the old one doesn't have support for overlayfs, nor does it contain the dtbos for enabling additional uarts.
Load the overlays:
root@010706e:~# mkdir -p /sys/kernel/config/device-tree/overlays/ttys1
root@010706e:~# cat /mnt/boot/dtb/overlay/sun8i-h3-uart1.dtbo > /sys/kernel/config/device-tree/overlays/ttys1/dtbo
root@010706e:~# mkdir -p /sys/kernel/config/device-tree/overlays/ttys2
root@010706e:~# cat /mnt/boot/dtb/overlay/sun8i-h3-uart2.dtbo > /sys/kernel/config/device-tree/overlays/ttys2/dtbo
Check dmesg to see the devices:
root@010706e:~# dmesg | grep tty
[ 70.203647] 1c28400.serial: ttyS1 at MMIO 0x1c28400 (irq = 145, base_baud = 1500000) is a U6_16550A
[ 81.883428] 1c28800.serial: ttyS2 at MMIO 0x1c28800 (irq = 146, base_baud = 1500000) is a U6_16550A
Switch baudrate to test with PC:
root@010706e:~# stty -F /dev/ttyS1 115200
root@010706e:~# stty -F /dev/ttyS2 115200
Connect uart cable from PC to pins to 11 & 13 for uart2 and to 38 & 40 for uart1 and test with minicom:
root@010706e:~# cat /dev/ttyS1
this is a test on uart1
root@010706e:/# cat /dev/ttyS2
this is another test
As I said, the procedure for loading the overlays on the Orange PI Zero should be pretty much the same, only the actual pins on the header will probably differ, for when you connect your cables.
Hello @acostach,
After trying your solution to my OrangePi zero using the new BalenaOS 2.45.1+rev1, ttyS1 and ttyS2 are now working. Thank you very much for your help!
After working with the serial ports, I noticed that this must be done each time the device is power cycled. Is there a way to automate this so it runs these commands on boot? I tried to run these in a node-red container I have on my device and /sys/kernel/config/device-tree is not presented to the container. What could I do to fix this issue?
Thank you
Hi, are you using a multicontainer app or a single container? If single container, is the container running in privileged mode?
Hello, it is a multicontainer environment, but they are independent of each other. The container using the UART is a node-red container that is running in privileged mode.
Hi @Andrew-Wallace ,
In the hostOS, the path you mention is mounted as a configfs by the sys-kernel-config automount.
Therefore, for the container can you please try mounting it like this:
mount -t configfs none /sys/kernel/config
before loading the dtbo files as usual?
Hello @acostach,
After running the mount command this is as far as I got: `root@173d061f4c1c:/usr/src/node-red# mount -t configfs none /sys/kernel/config
root@173d061f4c1c:/usr/src/node-red# mkdir -p /sys/kernel/config/device-tree/overlays/ttys1
root@173d061f4c1c:/usr/src/node-red# cat /mnt/boot/dtb/overlay/sun8i-h3-uart1.dtbo > /sys/kernel/config/device-tree/overlays/ttys1/dtbo
cat: /mnt/boot/dtb/overlay/sun8i-h3-uart1.dtbo: No such file or directory`
Thank you
Hi @Andrew-Wallace ,
/mnt/boot is a path accessible only from the rootfs, not from container.
Please store the dtbos either in a volume of your application, or add them to your application container directory using COPY in your Dockerfile:
https://www.balena.io/docs/learn/develop/multicontainer/#named-volumes
Hello,
I am having trouble connecting a UART device to the OrangePi Zero from the onboard pins. When physically connected, the /dev/ttyS1 does not present itself to the kernel and it does not show that a device is connected. It appears that these ports are not enabled. Any help on this would be great!
Thank you