2 Modbus-tk slaves

436 views
Skip to first unread message

Thorsten Schwonbeck

unread,
Nov 21, 2017, 4:37:58 AM11/21/17
to modbus-tk
Hello,

i have got 2 different devices with modbus-tk as slave(ID 2 and ID 3).
When only one device is connected to the bus, all works fine,
but with 2 devices the bus get spamed.

When i ask after slave 2 than slave 2 is replying but salve 3 is sending the same request to the bus again because he is not salve 2.
Same problem when i ask salve 3.

And than they spam the bus.

How can i stop them to relay the request?

Best
Thorsten

Thorsten Schwonbeck

unread,
Apr 11, 2018, 8:01:16 AM4/11/18
to modbus-tk
Is there no one who got the same problem?

Kjell Karlsson

unread,
Jan 2, 2019, 11:58:31 AM1/2/19
to modbus-tk
Hi Thorsten,
I have exactly the same problem as you have described. Have you found a solution?

Thorsten Schwonbeck

unread,
Jan 4, 2019, 6:10:32 AM1/4/19
to modb...@googlegroups.com
Hi Kjel,

No i did not find a fix for this problem.
I did not have time to look into it, but now i need to fix it.
I have to finish a project, with this problem, latest faburary.

When i find a solution i will tell you.



--
You received this message because you are subscribed to the Google Groups "modbus-tk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modbus-tk+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted
Message has been deleted

Kjell Karlsson

unread,
Jan 6, 2019, 3:17:01 PM1/6/19
to modbus-tk
Hi,
I have changed the server example file to minimize the code and implemented it in two Raspberry (I & II) pies. I connected my computer and the pies via a RS485 bus. They are the only units on the bus. First I run with a master (on my PC) and one of the pies (I) as slave (ID 0x9). This is working fine. Next step was to start the second slave (ID 0x8) (raspberry II) as well. I was logging both the traffic on the bus with a terminal software as well as with the logging function on the pies. I have attached the server program (for each pie) and the logging file. For me it seams like the server (slave) sends error information on the bus. If the master sends out a request to ID 0x9 (= raspberry I) the slave response correctly. The same request also activates the second slave unit (= raspberry II) with ID 0x8. This unit do not have a slave with ID 0x9 and therefore sends out an error. In the log file this is stated as "handle request failed: Slave 9 doesn't exist". The response from the raspberry II to RS485 is 131 - 4. First question: Why does raspberry II respond at all? There should only be a respond from a slave if there is no communication error and the slave exists. Obviously the slave does not exists in raspberry II.

The response from raspberry II activates raspberry I. The slave in raspberry I finds the response to be incomplete, "handle request failed: Request length is invalid 2" and sends out 129 - 4 on the bus. This activates raspberry II who also find the response to be incomplete and sends out 129 - 4 and now the infinite loop has started.

Second question: This is an obvious communication error. The request length is invalid so why does the slaves responds at all?

I realized I don't know the version of my modbus_tk. How could I get it?

Is there any thing missing in my server set up to get rid of the faulty responses?

Is this a bug in modbus_tk?

Best regards,
Kjell
NDC_multithreading_tk _avskalad_micro_ID_9 (1).py
Log from slaves with comments.txt
NDC_multithreading_tk _avskalad_micro_ID_8.py
Message has been deleted
Message has been deleted

Kjell Karlsson

unread,
Jan 9, 2019, 9:29:14 AM1/9/19
to modbus-tk
Hi,
It seems like our problems were solved in issue #92. Unfortunately there has been no update of the package on PyPI since then. It would be gratefully appreciated if the package on PyPI could be updated with the solution for #92. I have no idea of how to update dist-packages  manually with latest modbus.py and modbus_rtu.py.
Best regards and thank you all involved in modbus-tk,
Kjell

Luc JEAN

unread,
Jan 9, 2019, 11:31:38 AM1/9/19
to modb...@googlegroups.com
Hello all, 

Thanks for the fix. I will push a new version soon. 

Best
Luc



Envoyé de mon iPhone
--

Luc JEAN

unread,
Jan 10, 2019, 3:28:22 AM1/10/19
to modb...@googlegroups.com
Hello all,

modbus_tk 0.5.9 has been released this morning.

Best
luc

Le 9 janv. 2019 à 15:29, Kjell Karlsson <kvist...@gmail.com> a écrit :

Kjell Karlsson

unread,
Jan 15, 2019, 6:27:17 PM1/15/19
to modb...@googlegroups.com
Hi,
were I think I have solved the issue with using more than one server unit connected to the same bus. I have connected two server (slave) units and one client (master) unit and all units behave nicely together. Luc could you check it and if OK include in the next release.
Best regards,
Kjell
Reply all
Reply to author
Forward
0 new messages