Python Forum
Segmentation fault when connecting to modbus device with Libmodbus
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Segmentation fault when connecting to modbus device with Libmodbus
#1
I have a Raspberry Pi with an armhf system. I am getting Data from a Modbus Device with TCP, therefore I use the C Library libmodbus through ctypes.
It works fine on the Raspberry. But when I tried it on a amd64 system with the same packages(just the lib for amd64),it doesnt work and throws a Segmentation fault after creating a context for the connections when going into the modbus_connect() function.


import ctypes as ct

libc = ct.CDLL("libc.so.6")
libm = ct.CDLL("libmodbus.so.5.0.5")
modbus_t = libm.modbus_new_tcp('192.168.1.1',502)

if libm.modbus_connect(modbus_t) == -1:
.
.
.
-Segmentation fault
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  make: *** [Makefile:29: all] Segmentation fault Anldra12 2 1,795 May-01-2022, 06:17 PM
Last Post: Anldra12
  Simple syntax to asynchronously get access to MODBUS register orion67 1 2,771 Jan-22-2022, 12:40 PM
Last Post: orion67
  Segmentation fault (core dumped) hobbyist 1 10,295 Jun-07-2021, 12:56 PM
Last Post: supuflounder
  Modbus-tk library catching modbus-tk exception zazas321 1 2,048 Nov-10-2020, 03:06 PM
Last Post: Larz60+
  Reading UDP from external device without device software ikdemartijn 2 3,312 Dec-03-2019, 04:29 PM
Last Post: Larz60+
  Segmentation fault with large files kusal1 3 2,681 Oct-01-2019, 07:32 AM
Last Post: Gribouillis
  OpenCV - Segmentation fault samtwilliams 6 7,160 Sep-18-2019, 12:01 AM
Last Post: Larz60+
  Multiple calls to Python interpreter embedded in C++ application yield segmentation f mmoelle1 0 2,781 Mar-21-2019, 08:54 PM
Last Post: mmoelle1
  Debugging a seg fault tidymax 1 2,810 Oct-31-2018, 02:58 PM
Last Post: ichabod801
  calling python function in c++ callback getting segmentation fault error Jotirling 3 7,099 Oct-26-2017, 08:55 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020