Hi All, I intend to use the UART on J21 on a TX2 as a standard data exchange vs Console/Debug. I used the following two links and had partial success, however, I am now stuck.
Usually that kernel parameter is in “/boot/extlinux/extlinux.conf”. You could edit that out of any line it occurs in. Do beware though that boot stages might also use the serial console, and to stop that you might end up recompiling some of the boot software. If you only care about the UART once booted, then that shouldn’t be a problem. Sometimes people use that UART that way though and find boot halts…this would be because of sending data to that UART during boot stages could be misinterpreted as a keyboard key stroke.
After the TX2 is turned on and it on for a while, I run a python code on TX2 which reads from ‘/dev/ttyS0’ and it communicates to a putty application on host computer. I send about 15 chars using the putty to the TX2 which is printed by the python code. After 15 chars, The Putty puts a message ‘login’ and the standard two way communication breaks. I use the UART from J21 for this setup.
Please note the followings:
I have my image that is flashed onto the TX2 set up such that the file ‘/boot/extlinux/extlinux.conf’ has the following content right out of the box.
I do the same exact set up using J17 and get a continuous communication. For some reason, I have failed to disable /dev/ttyS0, since it is configured to tty.
I noticed that for some reason the following messages show up on the Putty application on the host after 15 chars are exchanged between the applications. Please note that my python code does not initiate that:
I have to note that the debug UART is a combined UART, which means it output log from several firmwares. As linuxdev mentioned, many firmwares(e.g. MB1, MB2, bpmp, spe..etc) may output log to this port and you can not disable them completely. If your UART use case can work after boot up, you can try the following methods to disable it from kernel.
remove console=ttyS0,115200 in kernel command line through extlinux.conf
add quiet to above kernel command line
run the following command to disable getty service.
Please check if above methods can help you using this UART interface after boot up.
If you still hit any issue, please share the full dmesg and device tree for further check.
Thank you for the feedback. The steps below are taken and the results stayed the same. About 15 chars into the communication between my python code on TX2 and Putty on the host, some service from the TX2 sends a login request as presented above.
remove console=ttyS0,115200 in kernel command line through extlinux.conf
add quiet to above kernel command line
run the following command to disable getty service.
You can see the actual final kernel command line via: cat /proc/cmdline
You should only need to issue the systemctl stop nvgetty.service and systemctl disable nvgetty.service once. If you’ve done this, reboot, and in addition to noting what cmdline shows, run this command: systemctl status nvgetty.service
Incidentally, unless someone is shipping a unit to the customer, I advise always removing “quiet” from extlinux.conf.
Thank you @linuxdev for your feedback. My issue of disabling TX2’s UART on J21 persists. It is partially working, since Puttyy on the host can exchange about 15 chars with a python code on TX2, however some service/server on TX2 sends a ‘login’ message and interrupts the desired communication. Actual message is below:
Another question regarding the TX2’s UART on J21. It’s default baud rate is 115200, so it works fine with that rate. which means that I can do data exchange between the putty (baud rate of 115200) on host and python (baud rate of 115200) on TX2. However, after I change the code to configure the /dev/ttyS0 to 921600 both on the putty (host) and my python (TX2), the data exchange hangs after a while.
Please add a bit of more detail on the ‘configure its parent clock to be compatible for other baud rates’. Found an example in Changing UARTC parent clock frequency.
TX2 has a bug within the baud rate generator, which exceeds the allowable 4% tolerance.
Don’t go over 115200 bps.
Use two stop bits for better fault tolerance.