I have an ESP32 Thing Plus running a variation on the Magnetic Sensor example that writes 5 lines per second to Serial (in Arduino IDE). The works fine on Win11. It works initially on a Raspberry Pi running Ubuntu 20.04.5, but if ttyUSB0 is closed and re-opened, no output is detected. It has the identical behavior on a Ubuntu 20.04.4 Lenovo AMD64 box.
If I replace the Thing Plus with a Teyleten Robot ESP-WROOM-32 development board, the same Arduino program works perfectly.
While Googling the problem, I find there are quite a few other people with the same or similar problem looking for solutions, so I think we can rule out a fault in my specific Thing Plus board.
Feels like a driver problem. Possibly the driver you have isn’t asserting CTS/DTR correctly? I’ve see similar issues with the usb to serial drives apple supplies for mac.
If it were a driver problem, it would have failed on both ESP32-WROOM boards. The driver is cp210x from Silicon Labs, which ships on virtually all Linux systems for years. The Windows driver is also cp210x.
Again, I’ve had this exact same issue on multiple different Mac computers and it was always a driver issue. For some reason there are drivers out there that work fine with RX/TX and will work fine with hand shaking the first time a device is plugged in but handshaking fails on all following attempts.
If you unplug the board and then plug it back in and are able to send code again one time that would confirm its a bad driver and you need to download the latest version from SI.
It is the most version of the driver from SL. Arduino IDE turns off all flavors of flow control, so it isn’t a flow control issue either. And the fact that it work fine with a different ESP32-WROOM board is pretty much definitive. And if it were a flow control issue, it wouldn’t work the first time it was opened and it wouldn’t have worked with the other ESP32. And, by the way, neither the Raspberry Pi nor the AMD64 Linux system were MACs.
Since the issue is clearly the ESP32 Thing Plus, it would be nice to Sparkfun to take some responsibility and investigate the problem. I would be more than willing to provide any information necessary. So unless the problem is a defective board, the ball is in their court.
Arduino IDE turns off all flavors of flow control, so it isn’t a flow control issue either.
The IDE actually uses flow control signals to upload to the board so it most definitely does not turn flow control off.
And, by the way, neither the Raspberry Pi nor the AMD64 Linux system were MACs.
Yeah, I get that, im not an idiot.
And the fact that it work fine with a different ESP32-WROOM board is pretty much definitive.
Different board by a different manufacturer with possibly a different usb to serial chip. I can not locate a schematic for your other board so I don’t know what chip it uses or even if the chip is a genuine chip and not a chinese knock off.
If you look at the sparkfun schematic, that will confirm what I’m saying about flow control signals is true. If you do not even want to try the advice I’m giving you then continue to wander around in the weeds not being able to make your board work. I don’t have the time or patience to continue arguing with you.
The ESP32 Thing Plus has a cp2104 chip, the other ESP32 board has a cp2102. According to the Arduino IDE documentation, all flow control is turned off for the USB Serial class. But, if RTS/CTS were turned on on the chip but not on the ttyUSB0 fd on the Linux system, so no data would be received the first time it was opened. But the hang doesn’t happen until the second open (and nothing has changed the state of the ttyUSB0 device in the interim. It is quite obvious that the cp2104 chip and the cp210x USB driver have an obscure failure to communicate. The cp2102 chip is clearly marked Silabs; the chip on the Thing Plus board is unreadable, but the schematic does show a cp2104.