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
  Modbus-tk library catching modbus-tk exception zazas321 1 167 Nov-10-2020, 03:06 PM
Last Post: Larz60+
  Reading UDP from external device without device software ikdemartijn 2 678 Dec-03-2019, 04:29 PM
Last Post: Larz60+
  Segmentation fault with large files kusal1 3 637 Oct-01-2019, 07:32 AM
Last Post: Gribouillis
  OpenCV - Segmentation fault samtwilliams 6 2,734 Sep-18-2019, 12:01 AM
Last Post: Larz60+
  Multiple calls to Python interpreter embedded in C++ application yield segmentation f mmoelle1 0 942 Mar-21-2019, 08:54 PM
Last Post: mmoelle1
  Debugging a seg fault tidymax 1 1,042 Oct-31-2018, 02:58 PM
Last Post: ichabod801
  calling python function in c++ callback getting segmentation fault error Jotirling 3 3,891 Oct-26-2017, 08:55 AM
Last Post: Larz60+
  Display device details i.e connected with more than one device shintonp 6 2,571 May-10-2017, 06:00 AM
Last Post: shintonp
  Compiler fault or some kind of weird referencing bug? Joseph_f2 11 4,808 May-09-2017, 08:50 PM
Last Post: volcano63
  Thai Text Segmentation Module draems 4 4,353 Feb-03-2017, 03:29 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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