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