Solved Modbus TCP getting Error -309
-
Split topic from https://forum.rexygen.com/topic/203/modbus-rtu-multiple-read/3
-
@cechurat The hardware is installed and now I'm trying to get the Modbus TCP communication up and running.
Data is coming in but I get these error messages regularly (I'm using the 'passive' feature) :
-
This is the data which we want to read out :
If period is not set to 1sec then there is no data at all, only error messages.
Data from registers configured at line 17 to 21 in the above list are also not showing.If only the first chunk of 56 registers is configured everything is working more or less fine (with socket errors from time to time)
Is there anything I can do to improve this?
In the future, we need to read the same data not from one but from four devices. Would it make sense to sort the registers in this file in such a way that there is never a consecutively reading from the same device? Or doesn't it matter what the sequence is in this list?
-
@apollo Hi Kris,
I have few questions:
-
What is timing of your project? (tasks and MbDrv)
-
Can you record and share a log with settings from the following post?
https://forum.rexygen.com/post/790
(from the log you will also get an idea how the MbDrv sequencing works which might help you to improve the settings)
Let me answer your question about registers order: Yes, it would make sense to mix the slaves. The order matter with respect to the same "Period" settings. (MbDrv works as a priority queue)
Thanks for cooperation.
Cheers,
Tomas -
-
@cechurat
In the meanwhile, I succeeded to get the communication up & running by reducing the Maxrequest value from 15 to 1.
But still with some error messages from time to time.I do also have some Modbus clients which are already configured but not online yet. could it be that they cause some issues?
-
@apollo Hi Kris,
thanks for sharing additional information. Max. requests option is maximum number of Modbus telegrams in the queue. Especially the embedded devices with limited memory usually have a small TCP/IP stack buffer.
The errors you get are probably referring to the offline clients:
2021-03-03;18:04:37.690;Error;MBDRV: Socket receive error (idx=2, code=113); 2021-03-03;18:04:37.690;Info;MBDRV: Client 2 disconnected; 2021-03-03;18:04:37.690;Error;MBDRV: Error while receiving data(ignore, code=-309);
According to the log see which Clients are online/offline. Is that right?
Cheers,
Tomas -
@cechurat
Thank you for taking a look at it.That's correct, these clients are still to be installed.
The idx parameter in the error message does this one refer to the clients in the config file, starting from idx=0 for the first entry?
-
@apollo Yes, you are right about the indexing. Starting with upcoming REXYGEN release the error message will contain Slave Name and its IP address for better understanding.
Cheers,
Tomas