Python Forum

Full Version: Segmentation fault when connecting to modbus device with Libmodbus
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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