Re: serial/ulscom: response timeout using pySerial/esptool.py

From: Tom Jones <thj_at_freebsd.org>
Date: Thu, 25 Apr 2024 21:05:07 UTC
Can you isolate out the extraneous stuff and loop tx and rx on a CP2101 board and send bytes through? 

I did a bunch of development on an esp8266 board in the last few weeks and had no issues, but I’ve no idea if it were the same usb serial chip. 

I’ll have a dig around and see if I have something matching 

On Thu, Apr 25, 2024, at 20:17, FreeBSD User wrote:
> Hello,
>
> Host: 15.0-CURRENT FreeBSD 15.0-CURRENT #36 main-n269703-54c3aa02e926: 
> Thu Apr 25 18:48:56
> CEST 2024 amd64 or 14-STABLE recently compiled (dmesg/uname not at 
> hand).
>
> Hardware: oldish Z77Pro 4 based Asrock mainboard, a Lenovo T560 
> notebook, Fujitsu Esprimo Q5XX
> (simple desktop, Pentium Gold) or an oldish Fujitsu Celsius 7XX 
> workstation, 6 core Haswell
> XEON.
>
> Phenomenon: a couple of weeks now I try to connect to several Xtensa 
> ESP32 dev boards
> (ESP32-WROOM32 with CP2101 or CP2104 UART) via comms/py-esptool 
> (doesn't matter whether it is
> tho port's py39-esptool 4.5 or the latest py-esptool 4.7.0, doesn't 
> matter whether pkg package
> or self compiled on CURRENT and 14-STABLE, on all hardware platforms 
> same result).
>
> Attaching the ESP devel module via Micro USB cable (several type, 
> differnt vendors tried ...)
> show
>
> dmesg:
> [...]
> ugen0.4: <Silicon Labs CP2102 USB to UART Bridge Controller> at usbus0
> uslcom0 on uhub3
> uslcom0: <Silicon Labs CP2102 USB to UART Bridge Controller, class 0/0, 
> rev 1.10/1.00, addr 4>
> on usbus0
> [...]
>
> When trying to connect to the ESP32 via below shown command (--trace 
> not every time issued), I
> get no connection:
>
> [ohartmann]: esptool.py --trace --chip esp32 --baud 115200 --port 
> /dev/cuaU1  flash_id
> esptool.py v4.7.0
> Loaded custom configuration from /pool/home/ohartmann/esptool.cfg
> Serial port /dev/cuaU1
> Connecting...TRACE +0.000 command op=0x08 data len=36 wait_response=1 
> timeout=0.100 data=
>     0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
>     5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
>     55555555                          | UUUU
> TRACE +0.000 Write 46 bytes: 
>     c000082400000000 0007071220555555 | ...$........ UUU
>     5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
>     5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
> TRACE +0.102 No serial data received.
> TRACE +0.052 command op=0x08 data len=36 wait_response=1 timeout=0.100 
> data=
>     0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
>     5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
>     55555555                          | UUUU
> TRACE +0.000 Write 46 bytes: 
>     c000082400000000 0007071220555555 | ...$........ UUU
>     5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
>     5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
> TRACE +0.107 No serial data received.
> TRACE +0.054 command op=0x08 data len=36 wait_response=1 timeout=0.100 
> data=
>     0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
>     5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
>     55555555                          | UUUU
> TRACE +0.000 Write 46 bytes: 
>     c000082400000000 0007071220555555 | ...$........ UUU
>     5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
>     5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
> TRACE +0.107 No serial data received.
> TRACE +0.054 command op=0x08 data len=36 wait_response=1 timeout=0.100 
> data=
>     0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
>     5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
>     55555555                          | UUUU
> TRACE +0.000 Write 46 bytes: 
>     c000082400000000 0007071220555555 | ...$........ UUU
>     5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
>     5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
>
>
> A serial exception error occurred: device reports readiness to read but 
> returned no data
> (device disconnected or multiple access on port?) Note: This error 
> originates from pySerial.
> It is likely not a problem with esptool, but with the hardware 
> connection or drivers. For
> troubleshooting steps visit:
> https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
> [...]
>
>
> Whatever baud rate issued, in most cases on all tested OS versions and 
> almost all hardware
> platforms except the Fujistu Celsius 7XX (2015 model) I do not get any 
> connection! And it get
> more weird: To avoid out-of-sync-software I recompiled everything via 
> "portmaster -df
> comms/py-pyserial comms/py-esptool" and after that, everything was 
> fine, the connection was
> made, I got results out of the chip. Seconds later same problems.
>
> I exchanged cablings, exchanged the ESP32 model and vendor. Invariants 
> are 14-STABLE, daily
> compiled, CURRENT. daily compiled. On my private box (old Z77 based 
> IvyBridge ASRock crap), a
> couple of Lenovo T560 running 14-STABLE and several Fujitsu Esprimo 
> Q5XX boxes there is always
> this weird error message, but in very rare cases I get connection.
>
> Only exception: the Fujsitus Celsius 7XX workstation (14-STABLE, last 
> complied today noon). No
> matter what ESP32, no matter what vendor, no matter what cablin used: 
> connection is established
> at any BAUD rate issued at any time. Not one single failure as shown 
> above in any session (I
> checked several tenth times)!
>
> Now I'm out of ideas and I suspect the CP210X ulscom serial driver to 
> have trouble with most
> onboard serial chipsets.
>
> Can anyone help me track down this issue? Is there anything I could have missed?
>
> I drives me nuts ...
>
> Thanks in advance,
>
> Oliver
>
> 
> -- 
> O. Hartmann

-- 
- Tom