I'm trying to use cp210x to flash a esp32 board on ubuntu 18.04. I first tried with the built-in driver, and then downloaded, compiled, and modprob'ed the newest version from https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers. I've added $USER to `dialout` group. Sometimes it works, and sometimes (most of the time) it doesn't. When it stops working, I have to reboot my computer (a Dell 13 700). The situation is similar to the one described in this AskUbuntu question (without answers so far).
I am running esp32's `make flash` script, which fails with `serial.serialutil.SerialException: Could not configure port: (5, 'Input/output error')`.
On the dmesg output, this is when I first plug the esp32:
[ 2404.860292] usb 1-3: new full-speed USB device number 27 using xhci_hcd
[ 2405.055668] usb 1-3: New USB device found, idVendor=10c4, idProduct=ea60
[ 2405.055680] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2405.055689] usb 1-3: Product: CP2102 USB to UART Bridge Controller
[ 2405.055697] usb 1-3: Manufacturer: Silicon Labs
[ 2405.055705] usb 1-3: SerialNumber: 0001
[ 2405.069661] cp210x 1-3:1.0: cp210x converter detected
[ 2405.071771] usb 1-3: cp210x converter now attached to ttyUSB0
And these are the logs for when I run `make flash`:
[ 2409.730169] usb 1-3: USB disconnect, device number 27
[ 2409.730517] cp210x ttyUSB0: failed set request 0x7 status: -19
[ 2409.730536] cp210x ttyUSB0: failed set request 0x12 status: -19
[ 2409.730545] cp210x ttyUSB0: failed set request 0x0 status: -19
[ 2409.730849] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[ 2409.730942] cp210x 1-3:1.0: device disconnected
[ 2410.040108] usb 1-3: new full-speed USB device number 28 using xhci_hcd
[ 2410.219745] usb 1-3: New USB device found, idVendor=10c4, idProduct=ea60
[ 2410.219755] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2410.219762] usb 1-3: Product: CP2102 USB to UART Bridge Controller
[ 2410.219769] usb 1-3: Manufacturer: Silicon Labs
[ 2410.219774] usb 1-3: SerialNumber: 0001
[ 2410.232560] cp210x 1-3:1.0: cp210x converter detected
[ 2410.234601] usb 1-3: cp210x converter now attached to ttyUSB0
I think the may be to my laptop's usb devices, but I've reached my limit debugging this. The esp32 works in other systems with same ubuntu version.
Thanks in advance.
Is it possible to determine when exactly the disconnect occurs? For how long is the device connected before you receive the "USB disconnect, device number 27" message? What is your Linux kernel version?
Please note that this driver has only been written and tested on the Linux 3.13.0 kernel on Ubuntu 14.04.
I am also talking to our driver team about this.
Sorry for the long delay! I tried this one more time, now using Windows 10, with the same Dell computer (Insiron 13 7359), and it again did not work. It looks like there is *some* imcompatibility between my Dell computer serial device and the one from Esp32.
Regarding your questions, I can't exactly remember but I'll try my best:
Is it possible to determine when exactly the disconnect occurs? sorry, I can't determine it right now.
For how long is the device connected before you receive the "USB disconnect, device number 27" message? I've tried many situations, including "testing just after connecting the device" and "testing 15 minutes after having the device connected"
What is your Linux kernel version? not exactly sure but probably 4.X
Now, as the same problem happens in the same computer model (I tried 2 Dell Inspiron 13 7359), both in Linux and Windows, I think it may have some idiosyncrasy between the two serial chips. Other Dell computers have worked in this setup.
Finding out the Linux version - https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/
There are three components that could be incompatible. So, we need to test accordingly. Can you try to isolate each device and test it individually with the computer?
The upgrade procedure we recommend for troubleshooting in this way is
1. check to see that cp210x is loaded using lsmod, then
2. unplug the cp210x device (if you can), then
3. unload the module, then
4. remove it from the file system or move it to some temporary storage location if you are concerned that you might need it again
If something goes wrong, and then check to see that it is unloaded using lsmod again. Then move the new module into place. Then use insmod to load it. To build the driver, unzip the attached archive (linux_cp210x_latest.tar.gz), then cd into the folder and type "make".
The file name for the cp210x driver in linux is cp210x.ko. The location where the operating system will use/load the cp210x.ko module is /lib/modules/`uname -r`/kernel/drivers/usb/serial. `uname r` is not the literal path - using `` characters to wrap a string causes the contents to be executed in the shell and the output used instead. The command uname -r shows the version of the kernel.
The following commands are needed in order to do this. Some of these need to be invoked using sudo.
lsmod - shows a list of the current loaded kernel modules.
rmmod - removes (unloads) a kernel module. Needs to be invoked as root (use sudo).
insmod - inserts (loads) a kernel module. Also needs sudo.