Jetson nano2gb UART2 doesn't work

Hi,

I want to use 2 UART to communicate with my 2 devices at the same time but the UART2 always doesn’t work. I’ve tried to send commands through /dev/ttyS0 and /dev/ttyTHS2 to test my UART2, but both got no response. I’ve also swapped the order of my devices and whether device A or B worked pretty well with UART1. I am wondering if there’s something wrong with my testing code or other settings?

import serial
import time

ser1 = serial.Serial(“/dev/ttyTHS1”, 57600, timeout=0.1)
ser2 = serial.Serial(“/dev/ttyTHS2”, 57600, timeout=0.1) # Have tried ttyTHS2 and ttyS0.
#ser2 = serial.Serial(“/dev/ttyS0”, 57600, timeout=0.1) # Have tried ttyTHS2 and ttyS0.
time.sleep(1)

while True:
ser1.write(b"1,PING\r\n")
 response = ser1.readline()
 print("Uart1: ", response, end=‘\t’)

 ser2.write(b"1,PING\r\n")
 response = ser2.readline()
 print("Uart2: ", response)
 time.sleep(0.25)

responses:

Uart1: b’BDC\r\n’ Uart2: b’’
Uart1: b’BDC\r\n’ Uart2: b’’
Uart1: b’BDC\r\n’ Uart2: b’’

After swapped:

import serial
import time

ser1 = serial.Serial(“/dev/ttyTHS1”, 57600, timeout=0.1)
ser2 = serial.Serial(“/dev/ttyTHS2”, 57600, timeout=0.1) # Have tried ttyTHS2 and ttyS0.
#ser2 = serial.Serial(“/dev/ttyS0”, 57600, timeout=0.1) # Have tried ttyTHS2 and ttyS0.
time.sleep(1)

while True:
 ser1.write(b"1,PING\r\n")
 response = ser1.readline()
 print("Uart1: ", response, end=‘\t’)

 ser2.write(b"1,PING\r\n")
 response = ser2.readline()
 print("Uart2: ", response)
 time.sleep(0.25)

responses: (Both got nothing)

Uart1: b’’ Uart2: b’’
Uart1: b’’ Uart2: b’’
Uart1: b’’ Uart2: b’’

hello chungcy,

please check kernel messages to confirm you’re having correct serial ports registration.
for example, $ dmesg | grep THS

Thanks you, JerryChang.

After some after few trial and error, it seems that /dev/ttyS0 is the right file for J12 Uart2. I check kernel messages and find that /dev/ttyS0 has been set as a serial console by default. How can I change the default setting or how can I disable the serial console?

hello chungcy,

it’s /boot/extlinux/extlinux.conf to define the settings.
here’s documentation for your reference, Disable Console over UART.
thanks