Reseting USB from script - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Reseting USB from script (/showthread.php?tid=4723) |
Reseting USB from script - Aivaras - 19.04.2023 Hello, I was wondering if there is a command that would allow me to reset USB port? I am using LM5 Lite and I'm using USB for rs232 communication, but the problem I have is it sometimes hangs and does not send nor receive any commands and the only way I can make it come back alive is rebooting LM, so maybe only rebooting USB port would be a possibility? RE: Reseting USB from script - admin - 19.04.2023 Check system log in system config. Most likely your USB device reconnected and changed the port name from /dev/ttyUSB0 to /dev/ttyUSB1. You can use this function to find the port name. It will return nil if no port is found. Code: function findport() You should check for read errors to detect USB disconnect: Code: res, err = port:read(...) RE: Reseting USB from script - Aivaras - 24.04.2023 (19.04.2023, 06:47)admin Wrote: Check system log in system config. Most likely your USB device reconnected and changed the port name from /dev/ttyUSB0 to /dev/ttyUSB1. Hello admin, Unfortunately the problem is still here. USB does not change the port name. err displays: timeout system log puts out: Apr 24 13:57:01 LogicMachine kern.err kernel: [14656.417881] pl2303 1-1:1.0: pl2303_vendor_write - failed to write [0000]: -110 Apr 24 13:57:01 LogicMachine kern.err kernel: [14656.297931] pl2303 ttyUSB0: pl2303_get_line_request - failed: -110 Apr 24 13:57:01 LogicMachine kern.err kernel: [14656.177891] pl2303 ttyUSB0: pl2303_set_control_lines - failed: -110 Apr 24 13:57:01 LogicMachine kern.err kernel: [14656.057986] pl2303 1-1:1.0: pl2303_vendor_write - failed to write [0000]: -110 Apr 24 13:57:01 LogicMachine kern.err kernel: [14655.937909] pl2303 ttyUSB0: pl2303_set_line_request - failed: -110 Apr 24 13:57:01 LogicMachine kern.err kernel: [14655.818029] pl2303 ttyUSB0: pl2303_get_line_request - failed: -110 Apr 24 13:57:00 LogicMachine kern.err kernel: [14655.697920] pl2303 1-1:1.0: pl2303_vendor_write - failed to write [0009]: -110 Apr 24 13:57:00 LogicMachine kern.err kernel: [14655.578120] pl2303 1-1:1.0: pl2303_vendor_write - failed to write [0008]: -110 Apr 24 13:57:00 LogicMachine kern.err kernel: [14655.457913] pl2303 ttyUSB0: error sending break = -110 Any solutions? Or maybe I can restart USB port? RE: Reseting USB from script - admin - 24.04.2023 Try a different USB adapter. PL2303 is not very stable from my experience. Use CP2102 or genuine FTDI chips. RE: Reseting USB from script - Aivaras - 06.06.2023 (24.04.2023, 15:22)admin Wrote: Try a different USB adapter. PL2303 is not very stable from my experience. Use CP2102 or genuine FTDI chips. Hello admin, I have replaced USB adapter with genuine FTDI chip (FT232RL). The problem is still here. Any other ideas? RE: Reseting USB from script - admin - 06.06.2023 Are you using an extension cable? Most likely there's a noise source nearby that's causing USB interference. |