Connecting Teensy to TX2 via USB-to-Serial

  • TX2

This article guides you through the steps for installing the CDC ACM driver for recognizing your Teensy/Arduino board as a serial device (i.e., ttyACMx).

If you are having trouble connecting your Teensy/Arduino board to your TX2 as a serial device (e.g., ttyACM0), chances are you are using the (old) stock NVIDIA kernel that does not contain the CDC ACM driver by default. A note buried in the Teeensyduino’s website explains the situation:

Note from Teensyduino
The default kernel that ships with Jetson lacks the cdc_acm driver needed for USB serial communication. You can still use Teensy without this this driver, because Teensy Loader uses HID protocol, and the new Ports menu is able to natively detect USB devices even when their drivers don’t load. But to use the serial monitor with a Teensy programmed to be USB serial, you will need to install the cdc_acm driver.

If you are using L4T 28.2, then the CDC ACM driver should already be there [ref]. Anything older than that may have the CDC ACM driver missing. To verify if this is the case for you, check if the CDC ACM driver has been included in your kernel:

zcat /proc/config.gz | grep CONFIG_USB_ACM

If it shows:

# CONFIG_USB_ACM is not set

then you don’t have a CDC ACM driver.

Typically there are two ways to tackling a driver issue like this:

  1. Recompile the kernel to include the CDC ACM driver [ref]
  2. Install the CDC ACM kernel module [ref]

In what follows, we will take the second option here as this is only an 5-minute effort to make everything function correctly.


Environment

  • NVIDIA TX2 + AUVIDEA J120-IMU (carrier board doesn’t matter)
  • Ubuntu 16.04 LTS “Linux tegra-ubuntu 4.4.38-tegra #1 SMP PREEMPT” (with AUVIDEA-v1.6)
  • Teensy 3.2

[Step 1] Download and Install CDC ACM Kernel Module

Rather than compiling the kernel module from source code, this GitHub repo contains a compiled CDC ACM kernel module and a script for installing/enabling the module. Execute the following commands to download and install:

git clone https://github.com/jetsonhacks/installACMModule
cd installACMModule
./installCDCACM.sh
Kernel and Module Versions Match; Installing ...
'cdc-acm.ko' -> '/lib/modules/4.4.38-tegra/kernel/drivers/usb/class/cdc-acm.ko'
Installed cdc-acm Module

Your module is successfully installed and enabled if you see the above output messages. Otherwise you may have an inconsistent kernel version and you should compile the kernel module from source code by yourself.


[Step 2] Verify Teensy with CDC ACM Module (Optional)

To verify if Teensy can be correctly picked up by the CDC ACM driver, let’s connect the Teensy board to TX2 and use either of the methods below:

  • Check the USB tree:
    As shown in the output messages below, the driver for my Teensy board (Dev 12) is “cdc_acm”.
lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-tegra/3p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-tegra/4p, 480M
    |__ Port 3: Dev 12, If 0, Class=Communications, Driver=cdc_acm, 12M
    |__ Port 3: Dev 12, If 1, Class=CDC Data, Driver=cdc_acm, 12M
  • Check loaded kernel modules:
    The CDC ACM kernel (“cdc_acm”) should appear in the list of loaded kernel modules:
lsmod
Module                  Size  Used by
cdc_acm                28681  0
hidp                   22434  0
fuse                   89760  3
bnep                   15733  2
hci_uart               16463  1
bluetooth             555729  18 bnep,hidp,hci_uart
bcmdhd               7640843  0
spidev                 10966  0
pci_tegra              75659  0
bluedroid_pm           13564  0
  • Check the system log:
    Details of the device info are logged when a Teensy board is plugged into any of the USB ports on TX2. Use “dmesg” to view the most recent system logs. This is also one way to know which ttyACM ID has been assigned to the Teensy board.
dmesg
[77154.670034] usb 1-3: new full-speed USB device number 11 using xhci-tegra
[77154.871380] usb 1-3: feature bit otg_vbus_off set
[77154.920024] usb 1-3: New USB device found, idVendor=16c0, idProduct=0483
[77154.997397] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[77155.082851] usb 1-3: Product: USB Serial
[77155.130890] usb 1-3: Manufacturer: Teensyduino
[77155.182696] usb 1-3: SerialNumber: 2772670
[77155.234207] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 6
[77155.340767] cdc_acm 1-3:1.0: ttyACM0: USB ACM device
[77155.389960] usbcore: registered new interface driver cdc_acm
[77155.455949] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

References

  • [link] Recompile Linux kernel on TX2
  • [link] A guide to installing the CDC ACM kernel module
  • [link] A GitHub Repo with the compiled CDC ACM kernel module

Was this post helpful?

Leave a Reply

Your email address will not be published.