-
-
Notifications
You must be signed in to change notification settings - Fork 766
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
Add controller disconnect detection and resume #2496
Comments
I see how reconnecting is an issue when the port changes. However resuming after a user manually changed the connection settings and hit connect may be possible, at least while the machine is still continuing with the last sent instructions. As it will send confirmations and trying to reconnect at the moment while it is not done with the last sent instructions results in an error message the lines of "unexpected command confirmed" somewhere around the time the software tries to send "$I" to it.
No it doesn't. That's why I think it may be a power glitch...
Directly connected to the back of the computer. Tried the hosts USB3 and USB2 ports (so also different controllers on the Mainboard) already. My next step would have been trying to hook the cable and try to get an oscilloscope in to look for a voltage drop... Edit: Here is what I get when manually re-connecting while it is still executing the gcode from before loosing connection. (tried twice here). I think at least when a run uses absolute coordinates it may have a very high likely hood that these coordinates are unique in the entire run and therefore the software may be able to detect where it currently is based upon the information:
(the "Connection closed" above is from me manually hitting the disconnect button once the GUI stopped updating aka the usb re-connected, also seen within udev) |
my oscilloscope does not go down to 2uS, however using the 10uS resolution I can already see a drop in voltage on the D+ pin below 1V, so it probably is a power glitch that triggers the reset... btw, this is what the linux kernel logs on a disconnect:
|
Automatic resuming will (in my opinion) not be possible. When you connect to a GRBL controller or like in your case temporarily lost power it will reset. That means that its coordinates can not be guaranteed. If homing is enabled it will also require you to rehome the machine before it can be used. Without knowing the exact position of the machine it would be dangerous to resume the job. The second problem is that UGS only knows about commands that have been OK:ed by the controller. It does not know which commands that the controller has completed. So you can't resume from the latest sent line. You suggested that UGS could figure out which command it was executing by extrapolate it from the current controller position. Even if the position could be guaranteed it will be impossible to guess due to rounding differences on both the controller and UGS and also how certain commands are handled, for instance such Arcs which is broken down to small line segments by the controller. While I don't like the idea to try and fix these kinds of hardware problems with software, you have got a point. The disconnect detection needs to be fixed, and it should also try to clear all buffers both on the controller and in UGS. Once that is in place we could ease the process process for resuming. One such option could be to highlight the latest executed line in editor before it got disconnected where the user could safely evaluate and use the "Run from line" feature. |
No, it doesn't. But I by now also discovered that something is pulling D+ on the USB low (or better the voltage on the USB port falls below the limit when the spindle is getting into contact...), I.E. triggers a USB protocol reset. So the disconnect/reconnect bug I have is probably not representative then... For me, even after reconnecting in Universal G code Sender it still has my manually configured offsets and everything. It just doesn't continue the run. But all I have to do is hit "run from xxx" and enter a line somewhere around where it left off (as it's absolute coordinates).
That's a solvable issue, we know enough to narrow down the possible options enough to a point where we could say with certainty where it left off. But that's probably just because my initial assumptions about the effects of a disconnect are biased by the special case I'm hitting... It's probably not always the USB2Serial chips fault that causes a disconnect/reconnect... Edit: And in reply to your previous message, it's a CH341-uart, not a CH340, but because their version number is so close they're probably the same except for the voltage (as uart and not RS232). So the issue I'm hitting may even be representative then after all?
Edit2: It only shows up as a "CH341-uart" on the computer, the chip itself is labeled "CH340G". Probably because it uses the same drivers "Built-in firmware, software compatible with CH341, use VCP driver of CH341 directly." https://www.wch-ic.com/products/CH340.html |
I managed to work out the issue. It's the host side that is incompatible with that controller. Apparently on the newer mainboard the USB 2.0 ports were connected through a USB 3.0 controller. This chip didn't like this (probably because they're bending the specs somewhere). The host controller reset the USB protocol upon these errors which caused the device to reregister. For everyone else here is how you get it working:
The "real USB 2.0" controller made it way better. It doesn't re-register there. (I didn't test the original cable with the new controller, so 2 may be unnecessary). However the CNC now managed to freeze the entire computer (less frequently than it reconnected on the USB 3.0 controller motherboard but often enough to be annoying). Adding an USB Opto-isolator managed to fix that too. The only thing I don't understand is why on that older PC the controller wasn't detected at all when connected to the front IO but works flawlessly when connected to the back with an opto-isolator... I despise recommending to buy a different computer to work around a shitty controller, however these old computers are now cheaper than a raspberry pi (when bought used at least)... |
I am closing this as we now should have controller disconnect detection as of #2562. I think that we should evaluate how this is working before adding any "resume from last job" action. |
Description
Hi,
I've some issues with my controller and noticed that the software doesn't provide any user feedback when the controller disconnects. For some reason my controller keeps reconnecting mid-run (and only mid-run, still need to look into that further). The ttyUSB0 vanishes and a new ttyUSB1 shows up. The software doesn't detect any of this it just stops getting updated. It doesn't even show an error or timeout. It also does not clear the Controller State but keeps showing the last information received. Meanwhile the cnc continues to finish the last command the software sent and then just waits with the spindle still spinning. The software also does not appear to be able to reconnect. Nor did the "Run from..." action appear to work (I entered the value from controller:rowsSent +1 as starting value). My shape is also quite simple. Just a rectangular cut starting at the center of the material (where also my Zero is).
I think this may be a power glitch in the controller board. Maybe it's faulty, I don't know yet. I've this one: https://www.vevor.de/holzstichmaschine-c_11142/cnc-fraesmaschine-graviermaschine-3018-pro-500mw-laser-fuer-holz-leder-kunststoff-p_010923569466
And this is the project:
test.ugsd
The text was updated successfully, but these errors were encountered: