No serial Communication via UART (part of the Python script) when no monitor is connected to Jetson

I am running a Python code on TX2 that involves starting and stopping of an IP camera video recording (connected to Jetson’s Ethernet Port) using serail communication via Jetson’s UART Port.

The Python code uses pyserial for serial communication with a windows PC having TeraTerminal program running that sends and receives serial commands to Jetson via UART2. Jetson and PC are connected using a USB (on PC) to TTL Cable. The serial commands are ‘start’ and ‘stop’.

UART setting are:
Baudrate: 115200
Port: dev/ttyTHS1 (UART2)
Pins 4,5,6
8N1 - 8 start bits, No Parity, 1 stop bit
Hardware Flow Control - No
Software Flow Control - Yes

I connect a monitor (on its mini HDMI Port) and keyboard/mouse to TX2 while working on TX2. And for the final operation, monitor will not be used, and the python code has to run at startup.

I used Crontab to run the Python code at startup.
@reboot /home/jetson/jetson_startup/

The contents of the file are:

#! /bin/bash

cd /home/sadaf/jetson_startup
sudo python3

While the monitor is still connected, I reboot Jetson, and the Python code autoruns. I send serial commands ‘start’ and ‘stop’ to Jetson and the camera records the video.

HOWEVER, here is the problem: When I remove the monitor and the keyboard/mouse bluetooth dongle, and reboot Jetson. The python code runs at startup, but serial communication doesn’t work anymore (I wait for 60 seconds or more to issue the commands to make sure the everything is ready on Jetson).

I know that the python code is running at startup because I log the time when the python code runs in a log file (part of the python code), and I check afterwards there that the code does run at startup even when the monitor and keybord/mouse are removed.

I send serial commands over the UART and nothing happens. As if it has stopped recognizing the serial commands. The python code keeps running waiting to serial the commands. I have checked the baudrate etc and everything is fine.

Any insights?

hello saques07,

please refer to this topic, Serial Console – NVIDIA Jetson TX2.
were you able to access serial console with above after removing monitor and the keyboard/mouse bluetooth dongle?

Is this a third party carrier board? I am guessing it is since the HDMI port on the dev kit is full-sized.

FYI, the UART settings you gave should be good to go. It sounds like this works on command line…can you verify?

I’m not really a Python guy, but something commonly causing issues in similar cases (regardless of it being Python or any other language, e.g., bash) is that sometimes the environment variables matter. A logged in user will have more of this set than will an automated script running via init.

One suggestion is that you add a command to your Python script to run the system command “printenv”, and to log this to a file. Run once while your monitor is attached, move the file to a new name, and then capture the log of this created by the automated script when no monitor is attached. Then compare the two.

It is a third party board, yes. Auvidea J120.


The python code does run. It even writes to a file logging the time the code was executed. The problem seems to be with only the serial communication though. Serial ports are not working.

When it logs the printenv, what differs between the working and non-working cases?

Please contact with Auvidea support. Thanks