Interfacing with the Jetson USB port

I want to send an integer through a USB cable into an Arduino Nano. On Windows, I would use the port “COM3”, and on other linux machines I would use “tty/USB0”, but on the TX2 I cannot seem to find the address of the USB port. Is there a spreadsheet somewhere I can look at?

I tried following this tutorial
https://elinux.org/Jetson/Tutorials/Program_An_Arduino
but I cannot seem to find Device Drivers -> USB Support -> USB Serial Converter Support in the makeconfig.
I am at a dead end, and I want to know if there is a way to send serial communications from the USB port on the Jetson at the moment.

This is my code, very simple. It uses pySerial.

Am I providing enough information? This is my first forum post.

import time
import serial

PORT = ‘/dev/ttyUSB0’ #Who knows what the port will be on the jetson? tty something
BAUD_RATE = 9600

ser = serial.Serial(PORT, BAUD_RATE)
time.sleep(4)

typedString = “NOTHING TYPED”

while True:
time.sleep(1)
typedString = raw_input("ENTER ANGLE: ")
ser.write(typedString)

Hi,

Could you try this to check if FTDI driver finds your COM?

dmesg | grep FTDI

In addition to the dmesg and grep above, try monitoring dmesg at the moment of inserting or removing the FTDI USB connector. Get a live feed of dmesg changes:

dmesg --follow

When I plug the arduino in with dmesg --follow going, I get this:

[ 5478.873149] xhci-tegra 3530000.xhci: exiting ELPG
[ 5478.903340] xhci-tegra 3530000.xhci: Firmware timestamp: 2017-03-31 06:21:56 UTC, Version: 55.07 release
[ 5478.916752] xhci-tegra 3530000.xhci: exiting ELPG done
[ 5479.134978] usb 1-2: new full-speed USB device number 10 using xhci-tegra
[ 5479.272554] usb 1-2: New USB device found, idVendor=1a86, idProduct=7523
[ 5479.279344] usb 1-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 5479.286600] usb 1-2: Product: USB2.0-Serial
[ 5479.292197] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 6
[ 5480.562171] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 5
[ 5480.569227] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work ignore firmware MBOX_CMD_DEC_SSPI_CLOCK request

When I type grp | FTDI, I get this

[ 2.655110] usbserial: USB Serial support registered for FTDI USB Serial Device

Is that to be expected? It seems Serial devices are enabled, but when I go into the makeconfig, the serial support is still not there

It looks like FTDI driver does not work on Tegra.

This is the log from my host.

[1483244.749504] usb 2-1.8: new high-speed USB device number 77 using ehci-pci
[1483244.842279] usb 2-1.8: New USB device found, idVendor=0403, idProduct=6011
[1483244.842284] usb 2-1.8: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[1483244.842287] usb 2-1.8: Product: Quad RS232-HS
[1483244.842289] usb 2-1.8: Manufacturer: FTDI
[1483244.842813] ftdi_sio 2-1.8:1.0: FTDI USB Serial Device converter detected
[1483244.842859] usb 2-1.8: Detected FT4232H
[1483244.843290] usb 2-1.8: FTDI USB Serial Device converter now attached to ttyUSB0

Is there an existing driver I can download, or do you think this is an unavoidable problem with the TX2 architecture?

It is absolutely necessary that I find a way to outpit integer values from the Jetson to an Arduino. I’ve been considering sending a stream of bits from the Jetson’s GPIO pins and decoding said stream on the Arduino. Has anything like that been done before?

I connected an FTDI USB serial UART to a TX2 running L4T R28.1 to the micro-USB connector with a micro-A to full-sized-A adapter. I get a similar dmesg, but an infinite repeat of this (spaced about one to two seconds between messages):

extcon-gpio-states external-connection:extcon@1: Cable state 2

Under lsusb the adapter does not show up.

After switching from micro-USB to full-sized port it works, and “/dev/ttyUSB0” shows up. I used a different micro-to-full-size adapter, and this one worked. This shouldn’t happen, both ports should work the same for a USB2 device…adapters can change results. However, can we verify which port you are using on the Jetson? Can you show the output of the device under “lsusb” via any other Linux box? The FTDI serial USB adapter I am using shows as this (I am hoping the ID of your cable and my cable are the same…this would make the underlying chip the same):

Bus 001 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

What this says is that FTDI works out of the box on R28.1, but something is failing if using that on the micro-USB port. For other uses the micro-USB port has worked fine on this particular TX2. Are you using the micro-USB adapter which comes with the Jetson?

You should be aware that there are many versions of Arduinos, not all of them use FTDI chips. Depending on what the manufacturer has on hand, they may substitute a CP210x or similar. Typically they will report on lsusb as something similar to:

Bus 001 Device 005: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)

Which means that they would report as /dev/ttyACM*

Note that the Jetson TX2 does not ship with CDC ACM enabled, which requires the user to add the CDC ACM module themselves.

When I use lsusb, this is what’s reported.

Bus 001 Device 014: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

It seems like this is the name of the USB cable I am using, and not the Arduino. If I added the CDC ACM module, would the Jetson recognize my Arduino?

I’m not using the microUSB that came with the Jetson. What I think is the one that came with the Jetson doesn’t fit the Arduino, so I’m using the one that came with the Arduino.

I’ll try to find another machine to use lsusb on.

I am now using:

PORT = ‘/dev/bus/usb/001/001’

But I am getting this error:

Traceback (most recent call last):
File “gimbal.py”, line 9, in
ser = serial.Serial(PORT, BAUD_RATE)
File “/usr/local/lib/python2.7/dist-packages/serial/serialutil.py”, line 240, in init
self.open()
File “/usr/local/lib/python2.7/dist-packages/serial/serialposix.py”, line 272, in open
self._reconfigure_port(force_update=True)
File “/usr/local/lib/python2.7/dist-packages/serial/serialposix.py”, line 326, in _reconfigure_port
raise SerialException(“Could not configure port: {}”.format(msg))
serial.serialutil.SerialException: Could not configure port: (25, ‘Inappropriate ioctl for device’)

Is this a result of no drivers? Am I even using the correct directory?

I figured it out!
It was a matter of downloading a kernel component! I am now using ttyUSB0

Hi @actariah:

I have the same issue. I am also using the same Arduino Nano from QinHeng Electronics. How did you fix the issue? When you were saying “It was a matter of downloading a kernel component!” Which component were you referring to?

Thank you very much for your help.

AC

Not enough is known about your case to answer. However, realize that USB serial devices need a driver for whichever chipset is used. The serial FTDI device driver is installed by default. I’ve seen reference to some add-on boards needing the ACM driver instead (which can be built as a module and copied ot the Jetson). This would cause a USB serial UART to show as “/dev/ttyUSB0” for the first one, “/dev/ttyUSB1” for the second one, so on.

I have no knowledge of the Arduino devices so I don’t know what chipset or drivers it might require. You might need to look up somewhere which Linux driver is required for that device. ACM is a strong possibility.

The 28.1 JetPack does not include the USB serial drivers for ttyACM or FTDI.

You will need to update to JetPack 28.2 to get that driver, or re-build the driver modules using the “how to build drivers on the jetson” tutorials on the web.

Please try it on r28.2. The ACM drvier should have been enabled by default.

I am using R28.2 now. Having compiled and installed driver modules CH_341 from source,
The “QinHeng Electronics HL-340 USB-Serial adapter” still does not work.
I think it might not be ttyACM.

If you have a desktop PC which works with this, then perhaps you can monitor dmesg as you plug it in to see what it says as a clue to what the chipset might actually be (e.g., “dmesg --follow”). Also, if you run “lsusb” prior to plugging the device in, and then after you should be able to get an ID which can be looked up.

The ID field consists of a manufacturer and then a product separated by a colon. For example this is a TX2:

0955:7c18

…all NVIDIA USB products will be manufacturer ID 0955, the TX2 is the specific product 7c18 (if this were a different manufacturer ID it might still be 7c18, but then it would be a different product by that different manufacturer).

You can also do a verbose lsusb on that ID with sudo and perhaps it will say something. I’ll use the TX2 ID as an example, but edit for your device case:

sudo lsusb -d 0955:7c18 -vvv

One other possibility on your PC host is that if the driver is built as a module, then the output from “lsmod” prior to connecting the device can be compared with “lsmod” after insert…and the difference will be your device driver.

I eventually solved my serial problem and wrote a guide for HL 340.
Hope it will help other people who are using HL 340 serial devices.

https://devtalk.nvidia.com/default/topic/1032862/jetson-tx2/a-guide-to-solve-usb-serial-driver-problems-on-tx2/

Thanks for the sharing.