Python Forum
Segmentation fault when connecting to modbus device with Libmodbus - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Segmentation fault when connecting to modbus device with Libmodbus (/thread-14811.html)



Segmentation fault when connecting to modbus device with Libmodbus - alice - Dec-18-2018

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