8devices Community
https://www.8devices.com/community/

Libmodbus and select timeout problem
https://www.8devices.com/community/viewtopic.php?f=13&t=822
Page 1 of 1

Author:  Darlard [ 08 Oct 2014, 07:43 ]
Post subject:  Libmodbus and select timeout problem

Hi,
i am developing a modbus master device on Carambola 2 eval which has to manage a slave board.
I am using an FTDI 485 converter to connect to the slave board but i have lots of communication errors.

Problem is that i get a lot of timeout error from select() function.

Looking at 485 with a scope i could see that the slave is not compliant with Modbus specifications reagarding intra-frame delay.
Baudrate is set 19200 but the slave sometimes replies with 500us delay and less, where it should be not less then ~2ms.

Seems like the reply arrives before the device enters select(). So i get timeout. More than 20% of the request gets no answer.
This is frustrating because, with response timeout set at 500ms, this becomes a bottleneck.

If i simulate a slave via software and set a delay of ~80 ms, i get no errors and everything is fine. This is why i think the problem is with libmodbus being "slow".

Does anyone has suggestions? Have you ever experienced such errors?

Greetings!

Author:  karlp [ 15 Jan 2015, 10:54 ]
Post subject:  Re: Libmodbus and select timeout problem

You should really take this up with libmodbus. Depending on your rs485 adapter, and libmodbus, make sure you're not doing anything that involves userspace toggling of an RTS line for instance.

However, if you have a device that is replying that fast, at 19200 baud, then it's not just going to be you having problems, it's going to be thousands of other modbus masters. Often these devices have a configuration register that lets you modify the turnaround time / reply delay time / similar names. Definitely try and get the slave reconfigured!

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/