Jetson AGX Orin: tty device usable only once before failing

333 views Asked by At

I am using a barcode scanner as part of a project, everything works correctly until I exit the program then I can't communicate anymore with the barcode scanner. This holds true for whatever program I'm running, be it one of my own or just using screen to monitor the transmissions. As soon as I exit, the only way to make the scanner work again is to unplug and replug.

The scanner (this one) is always mounted correctly (usually at /dev/ttyACM0) and communicates by SSI over USB CDC.

I’ve tried monitoring with pyserial’s miniterm and with screen /dev/ttyACM0 9600 but the same problem arises (f.e. screen just says [screen is terminating])

Mind you, everything works well on another computer so I believe it might be an issue with the Jetson rather than the scanner.

In the project I’m trying to run, I use pyserial to interact with the device. Here is an extract of the code to give you an idea of how I use it:

import serial
serial_port = "/dev/ttyACM0"
baud_rate = 9600
 with serial.Serial(serial_port, baud_rate, timeout=0.1) as device_serial:
            device_serial.flush()
            while True:
                try:
                    # read a line from the serial port
                    barcode_byte_string = device_serial.readline()
                    if len(barcode_byte_string) > 0:
                        # convert the byte string to a string and strip the newline character
                        barcode = barcode_byte_string.decode("utf-8").rstrip()
                        # publish the barcode to the topic
                        self.publish_barcode(barcode, serial_port)
                except serial.SerialException as e:
                    # exit with error code 1. This will cause the application to be restarted.
                    sys.exit(1)
                except Exception as e:
                    break
0

There are 0 answers