question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stability of RS485 Connection

See original GitHub issue

If you’re using a RS485 over LAN Adapter there might be some connection interruption. If this occurs TWC Manager seems to not being able to handle this:

07:56:09 ⛽ Manager  20 Unhandled Exception:Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/serial/urlhandler/protocol_socket.py", line 171, in read
    raise SerialException('socket disconnected')
serial.serialutil.SerialException: socket disconnected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/TWCManager/lib/TWCManager/TWCManager.py", line 806, in <module>
    data = master.getInterfaceModule().read(dataLen)
  File "/usr/src/TWCManager/lib/TWCManager/Interface/RS485.py", line 65, in read
    return self.ser.read(len)
  File "/usr/local/lib/python3.7/dist-packages/serial/urlhandler/protocol_socket.py", line 178, in read
    raise SerialException('read failed: {}'.format(e))
serial.serialutil.SerialException: read failed: socket disconnected

It would be great if we are able to handle such interruptions and perform a full re-connect to the serial interface. I’m running on docker since a few days and restarting the container solves the issue immediatly. If I can assist with more information let me know.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ngardinercommented, Jul 25, 2022

Thanks for the output - it should be straightforward for us to catch that exception and reconnect the socket. I’ll let you know when there is something ready for you to test

0reactions
reklame33commented, Sep 18, 2022

@dehsgr, You could be right that my issue #473 might be duplicate.

I have pulled the testing image, changed timeout to 60 second, but still my log show that it times out on 26 seconds. Attached is a full 2 minute charge session after restart of the container, start charging to the interrupted charging occure when slave not responded within 26 second. twcmanager log.txt

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common failures of RS485 communication, solutions and ...
If there are many load 485 devices, the wire impedance is not up to the standard, the wire diameter is too thin, the...
Read more >
Troubleshooting RS485 networks
One common reason for the inability of devices to communicate, on a RS485 network, stems from the ambiguity in deciding how to mark...
Read more >
9 rules for correct cabling of the Modbus RS485 ...
The main cable must be no longer than 700 m ! This distance does not include the branches (which must nevertheless be short)....
Read more >
Precautions for RS485 wiring - Vedard Security Alarm
Therefore, the actual stable communication distance of 485 bus is far less than 1200 meters. Load much RS485 equipment, wire impedance is ...
Read more >
RS-485– Part 3: Red Flags and How to Avoid Them
Earth grounds are important to all electrical systems. They are especially important to communications for both reliability and for stability.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found