New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird tty behavior under frequent connect-disconnect screnario #467
Comments
It doesn't seems like it's a problem with uart driver or board itself, at least with |
Try logging all of the CNCjs messages using -vvv on the CNCjs server command line. |
Works:
One more connect-disconnect, still works:
Few more times, works:
And now it's dead:
I got repro without multiple browser magic, simply connect-disconnect from a single browser window. I did strace on cncjs process and it's clearly do write("$$") to /dev/ttyUSB0 FD. |
I have to leave soon for a Fourth of July celebration so I will not be able to work with you in detail for several hours. Since you seem to have a lot of debugging skills, I will give you some avenues to explore.
One way to investigate this further would be to do some kernel-level debugging of the CH341 driver. I see that you can talk to the driver with esptool, but it is still possible that the driver is getting hung in some way that affects only the way that CNCjs uses it.
Sorry, have to go now. |
Ugh, i really apologize, i had another device connected with CH34x uart and confused it with esp32. The problem happen on CP210x. I updated original post with right description. |
One final thought - the other problem report from CH340 ESP32 was consistent with the hypothesis that opening and closing the serial port could be causing glitches on the ESP32 enable line, thus partially resetting the ESP32 and getting it into a strange state. That hypothesis is consistent with your results. In particular, the fact that esptool can recover it is explained by the fact the esptool explicitly does a full hardware reset in order to put the ESP32 into bootloader mode. That reset involves controlling some lines via modem control signals that go through a cross-coupled latch on the ESP32 dev board. |
The debugging ideas around nodejs serialport still apply, even with CP2102. Happy debugging. Really must leave now., |
Please answer the following questions.
What version of the firmware are you using?
0469e7b of Devt, spi_daisy_4axis_xyz
fc6926d of master with spi_daisy_4axis_xyz
Is the problem repeatable?
Yes
Under what conditions does the bug occur?
raspberry pi, 4.19.66-v7+, esp32 with:
Bus 001 Device 005: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]
I've tried to reproduce it without using cncjs, with
screen /dev/ttyUSB0
, and failed to get clear repro. I've tried to spawn multiple FDs to TTY, but problem is something else. With CNCJS it's relatively easy to reproduce and makes it completely unusable.open browser 1, do "connect" against /dev/ttyUSB0
open browser 2, do "connect" against /dev/ttyUSB0
open browser 1, do "disconnect" against /dev/ttyUSB0
open browser 2, do "connect" against /dev/ttyUSB0
open browser 1, do "connect" against /dev/ttyUSB0
After few times doing that you'll get noop /dev/ttyUSB0 which will not recover until you hit reset button on ESP32.
You can attach to this /dev/ttyUSB0 but it won't respond on any commands. When hit reset it will spew normal boot message.
No
echo '[ESP444]RESTART' > /dev/ttyUSB0
will work, only physical reset.The text was updated successfully, but these errors were encountered: