Any one try to run libmodbus on OpenWrt?

447 views
Skip to first unread message

Chen Edwin

unread,
Jul 24, 2014, 6:25:00 AM7/24/14
to libm...@googlegroups.com
I tried to use libmodbus in OpenWrt MIPS system. the system has a UART port and connect to a Libmodbus via a UART to RS485 converter. i wonder if anyone has experience in use libmodbus in this environment? 

Noel

unread,
Jun 13, 2016, 6:23:35 PM6/13/16
to libmodbus
Chen, Did you make any progress about this?

I connected a max485 to the UART of a wr703n and plan to use the gpio8 as rts line.

My program start like so:

    ctx = modbus_new_rtu("/dev/ttyATH0", 9600, 'N', 8, 2);
    modbus_set_debug(ctx, 1);
    modbus_set_slave(ctx, 103);
    modbus_rtu_set_serial_mode(ctx, MODBUS_RTU_RS485);
    modbus_rtu_set_rts(ctx, MODBUS_RTU_RTS_DOWN);
    modbus_rtu_set_custom_rts(ctx, csetrts());

All works when I compile on my linux box. However when I cross compile it with the OpenWRT SDK I get the following error:

modbus-rtu.c: In function 'modbus_rtu_set_serial_mode':
modbus-rtu.c:916:31: error: 'TIOCSRS485' undeclared (first use in this function)
             if (ioctl(ctx->s, TIOCSRS485, &rs485conf) < 0) {

Should I set HAVE_DECL_TIOCM_RTS = 0 in config.h?

How can I get TIOCSRS485 properly declared otherwise?

Gianluca Di Simone

unread,
Dec 19, 2016, 6:21:24 AM12/19/16
to libmodbus
Hi Noel, do you solved this problem , I also use mips and have the same problem.

Gianluca
Reply all
Reply to author
Forward
0 new messages