Skip to content
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

Properly closing port #121

Open
ARK3r opened this issue Aug 30, 2023 · 0 comments
Open

Properly closing port #121

ARK3r opened this issue Aug 30, 2023 · 0 comments

Comments

@ARK3r
Copy link

ARK3r commented Aug 30, 2023

I have a usb-to-rs485 cable connected to an ubuntu pc controlling a motor controller.

When I connect the usb to the PC I get port 'ttyACM0' and everything works well.

But when I close the program, regardless of running instrument.serial.close() or not, the second time around running the same program I get this:

  File "drive_motor_lib.py", line 30, in write_register
    self.instrument.write_register(register, value, functioncode=6)
  File "/home/orin/.local/lib/python3.8/site-packages/minimalmodbus.py", line 552, in write_register
    self._generic_command(
  File "/home/orin/.local/lib/python3.8/site-packages/minimalmodbus.py", line 1276, in _generic_command
    payload_from_slave = self._perform_command(functioncode, payload_to_slave)
  File "/home/orin/.local/lib/python3.8/site-packages/minimalmodbus.py", line 1353, in _perform_command
    response_bytes = self._communicate(request_bytes, number_of_bytes_to_read)
  File "/home/orin/.local/lib/python3.8/site-packages/minimalmodbus.py", line 1521, in _communicate
    raise NoResponseError("No communication with the instrument (no answer)")
minimalmodbus.NoResponseError: No communication with the instrument (no answer)

Any thoughts on how I can proceed with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant