CP210x drivers

Hello. I am trying to use Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light with Jetson. I think it needs a drivers, because when I am looking for ttyUSB, there is no device. I was looking for built-in drivers:

zcat /proc/config.gz | grep CP210
# CONFIG_USB_SERIAL_CP210X is not set

I found a way to compile it via JetsonHacks tutorial about kernel compiling. But does whole kernel need to be recompiled? Is there a simple way to just install the CP210x driver?

Have you trying making just the module itself by trying

make M=path/to/module/directory

and then

make M=path/to/module/directory modules_install

I found CP210x installation script from JetsonHacks. Tomorrow I’ll check if it works, if not I will try your method

What it comes down to is that you only need a driver, and the driver can be built as a module while leaving the kernel itself alone (this is what @mashash is giving information for, I am just adding information in case you want to understand the process). If you have configured a kernel source tree to match the running system (get that from the system’s “/proc/config.gz”), and then added that module (e.g., via “make nconfig”…which requires package “libncurses5-dev”…“sudo apt-get install libncurses5-dev”), his command will build just the driver. Assuming you are natively on the Jetson doing the build and have set the CONFIG_LOCALVERSION, then the “modules_install” step will also put the module in place.

Official documents show how to cross compile which also works, but requires you to manually copy the driver module to the Jetson (plus requires installing the cross compile tools). FYI, the downloads URL for a particular L4T release (found with “head -n 1 /etc/nv_tegra_release”) has a “driver package”, and the driver package (not to be confused with kernel drivers…it is a host side flash driver) is downloaded by JetPack if you’ve ever flashed with JetPack. You’d always use the same “driver package” as what is flashed to the Jetson (this is the version from the previously mentioned “head -n 1 /etc/nv_tegra_release”). You can see a list of driver packages here (you may need to go here, log in, and then go here again before it shows the releases):
https://developer.nvidia.com/embedded/linux-tegra-archive
(btw, that listing has an error…R28.2 works on the TX1 and so you might have R28.2, but it wasn’t listed as a TX1 release)

Within the driver package (which unpacks to a “Linux_for_Tegra/” subdirectory) is file “source_sync.sh”. This file can be used to download the right kernel version, and this script works from any Linux system…including the Jetson. If you copy this script to a TX1, and as an example if your L4T release is R28.2, then this would get the right kernel source:

./source_sync.sh -k tegra-l4t-r28.2

A complete list of native kernel build instructions are here, but you only need the “make modules_prepare” and “make modules” command…or you can use the command given by @mashash (which is simpler, but you’d still want to use the source_sync.sh step to get kernel source). I give the rest of this information in case you want to understand a full kernel build:
https://devtalk.nvidia.com/default/topic/1028931/jetson-tx2/aws-greengrass-core-on-nvidia-jetson-tx2-requirements/post/5233943/#5233943

You should not need to “flash” anything, nor should you need to replace the kernel itself (the “/boot/Image” file).

Btw, if you were to manually copy the kernel module, the procedure would go something like this:

  1. Determine the output of "uname -r". I'll assume "4.4.38-tegra".
  2. sudo -s # You need to be root to do this.
  3. cd /lib/modules/4.4.38-tegra/kernel/
  4. Determine where the module is in the kernel source. I'll use the example:
    drivers/usb/serial/  # This will have the cp210x* files, and resulting cp210x.ko module.
    
  5. You're already at the base of this in the modules directory, so:
    cd drivers/usb/serial/
    cp /where/ever/it/is/cp210x.ko .
    cd
    depmod -a   # Or you could just reboot.
    exit
    

Your ttyUSB should now show up.