Systematic errors when consuming data each second

36 views
Skip to first unread message

alvaro...@eos-eng.com

unread,
Aug 8, 2017, 10:49:09 AM8/8/17
to libmodbus
Hello everyone,

I have been using libmodbus for almost a year now and today I have detected a problem that I would like to know if it has happened to someone before or if it is an application problem.

The application performs a series of Modbus requests to several TCP devices every second in parallel. A different Modbus context is created for each device. The MODBUS_ERROR_RECOVERY_NONE is set to MODBUS_ERROR_RECOVERY_NONE for every context, so that if 5 consecutive read errors occur, the connection socket is deleted for subsequent re-initialization.

The problem comes when suddenly, the application begins to experience multiple read errors of type "Invalid data". The socket is reset correctly after 5 errors, but read errors persist once the socket is new. The only way to solve this fault is to restart the program.

I wonder if the error can come from the structure of type modbus_t used by the library or if on the contrary can be from the application.

Thanks in advance

Chuck Watson

unread,
Aug 8, 2017, 11:24:18 AM8/8/17
to libm...@googlegroups.com

Have you implemented a reconnect delay?

 

If a device disconnects for any reason, wait 1 second or more for things to settle before attempting a reconnect.

 

The issue probably has more to do with your slave devices being slow to accept another connection attempt.

 

You restarting the application provides this delay.

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "libmodbus".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse libmodbus+...@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

alvaro...@eos-eng.com

unread,
Aug 9, 2017, 3:12:21 AM8/9/17
to libmodbus
Thanks for the advice. I'll try to wait before reconnecting each device.
Reply all
Reply to author
Forward
0 new messages