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:
Port: dev/ttyTHS1 (UART2)
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.
The contents of the startup.sh file are:
sudo python3 cameracode.py
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.