esptool.py not working on Linux guests?

Discussion in 'Linux Guest OS Discussion' started by l3xh2k, Nov 30, 2021.

  1. l3xh2k

    l3xh2k Bit Poster

    Messages:
    7
    Background:
    Anybody playing with Arduino / ESP32 uses esptool.py (often indirectly).
    It is a tool that talks to a USB connected ardiuno or esp32 device and can do useful things like reset, flash (download a new firmware), etc.
    It does this magic by talking to a USB<->serial bridge chip on the development board. These chips are typically either a CP210x from Silicon Labs or something from Future Tech Development (ftdi).
    The magic comes from the script manipulating the DTR and RTS lines on the serial port to toggle boot mode and reset the device (the boot mode providing a ROM bootloader).

    I have been unable to make this work under Parallels. A work colleague has demonstrated it working on a "real" PC running exactly the same Linux (Mint 20.2 fwiw). So I'm left wondering wtf... I'm on an imac running big sur running parallels 17.1.0 (51516).

    Any ideas welcome.
     
    MarcoM16 likes this.
  2. l3xh2k

    l3xh2k Bit Poster

    Messages:
    7
    I have thus far tried Ubuntu 20.4, 20.10, making my own kernel with some driver hacks to ftdi_sio, Mint without success.
    I updated Parallels to 17.1.1 (51537) no joy.
    I have tried a Windows 10 VM. Nope.
    I have tried a Windows 10 real machine. Works.
    My conclusion is that this is definitely a parallels/mac/usb virtualization problem -- making this kind of useless as an embedded dev platform.
     
  3. l3xh2k

    l3xh2k Bit Poster

    Messages:
    7
    One more data point. I see the same failure using VirtualBox :(

    I realize now that I did not include my test.

    The command I'm running is esptool.py -p /dev/ttyUSB0 read_mac. When it works (on my Mac), it should look something like this:
    esptool.py v3.1
    Serial port /dev/tty.usbserial-D200C0Q3
    Connecting...
    Failed to get PID of a device on /dev/tty.usbserial-D200C0Q3, using standard reset sequence.
    .
    Detecting chip type... ESP32
    Chip is ESP32-D0WD-V3 (revision 3)
    Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
    Crystal is 40MHz
    MAC: 40:f5:20:51:a6:50
    Uploading stub...
    Running stub...
    Stub running...
    MAC: 40:f5:20:51:a6:50
    Hard resetting via RTS pin...
    On a VM, it fails and looks more like this:
    esptool.py -p /dev/ttyUSB0 read_mac
    esptool.py v3.2
    Serial port /dev/ttyUSB0
    Connecting......................................

    A fatal error occurred: Failed to connect to Espressif device: Wrong boot mode detected (0x17)! The chip needs to be in download mode.
    For troubleshooting steps visit: https://github.com/espressif/esptool#troubleshooting
     
  4. l3xh2k

    l3xh2k Bit Poster

    Messages:
    7
    One more datapoint -- I just found that my test works using an ubuntu VM hosted on Windows 11 (VirtualBox).
     
  5. MarcoM16

    MarcoM16 Bit Poster

    Messages:
    3
    Hi l3xh2k, I guess we have a similar issue. I played in the past with Arduino / ESP32 esptool.py and I agree with you it seems a parallels/mac/usb virtualization problem.
    I am trying to use Teensy 4.0 dev board using Arduino IDE. This board does not use FTDI chip for serial communication, the micro has an embedded USB peripheral. Teens 4.0 is recognized as a COM port (Windows) or serial device (Mac, Linux). But I'm quite sure this difference is not relevant for the issue we are encountered.

    My setup is: MacOS Monterey 12.0.1, Win 10 OS and upgrade to Parallels desktop version 17.1.1, the new release available here

    The serial communication seems to be stacked, even if the Teensy 4.0 is recognized by Windows OS and I am able to program the board using Arduino IDE, which is weird. The upgrade to Parallels desktop version 17.1.1 partially solved the issue, because I am now able to read data at USB serial port. But still no joy when I try to write data to the USB serial port, it seems stacked or in timeout.
     
  6. l3xh2k

    l3xh2k Bit Poster

    Messages:
    7
    Glad I'm not the only one. This kind of tail chasing definitely comes with times where I question myself :D
    Anyway, since realizing that this is common to both parallels and virtualbox on mac, I posted this: https://github.com/espressif/esptool/issues/700
    Maybe somebody with access to source code (or the correct people inside Apple) will pick this up ¯\_(ツ)_/¯
     
    MarcoM16 likes this.

Share This Page