S
Scenario: There are two slaves say Slave 2 and slave 1. Slave 2 receives a frame of Slave 1. Slave 1's frame data field has a sequence of 02 06 00 and so on which it might consider as its frame. How to detect this false frame condition
Slave 2 has its buffer for receiving Modbus Frames say a buffer of 256. The way it would scan for its message is by checking a condition "whether its slave number and its subsequent function code matches" by examining each byte from the start of the buffer. If match occurs it would further examine the subsequent fields like data fields and so on. This condition it would check in its buffer.
If in the buffer of Slave 2 suppose it comes across a frame of Slave 1 where after examining the first byte it comes to know the first byte is 01 so it would not consider that byte and it would increment further to examine the next byte for station no match. Now further going into this frame which it did not consider for a match of station number and function code. if in the data field of that slave 1 frame it finds out a match of station number 02 and its consecutive byte, there is a function code match as well then eventually it would land up considering all the fields in that frame of Slave 1 which is not for itself.
Thus it would consider a part of frame by Slave 1 as its frame which eventually may extract a frame of arbitrary structure and might loss any further subsequent information which might be for itself.
My question is how to detect this condition where i get 02 06 that is station number and its subsequent function match which is in the data field of a frame of Slave 1.
Slave 2 has its buffer for receiving Modbus Frames say a buffer of 256. The way it would scan for its message is by checking a condition "whether its slave number and its subsequent function code matches" by examining each byte from the start of the buffer. If match occurs it would further examine the subsequent fields like data fields and so on. This condition it would check in its buffer.
If in the buffer of Slave 2 suppose it comes across a frame of Slave 1 where after examining the first byte it comes to know the first byte is 01 so it would not consider that byte and it would increment further to examine the next byte for station no match. Now further going into this frame which it did not consider for a match of station number and function code. if in the data field of that slave 1 frame it finds out a match of station number 02 and its consecutive byte, there is a function code match as well then eventually it would land up considering all the fields in that frame of Slave 1 which is not for itself.
Thus it would consider a part of frame by Slave 1 as its frame which eventually may extract a frame of arbitrary structure and might loss any further subsequent information which might be for itself.
My question is how to detect this condition where i get 02 06 that is station number and its subsequent function match which is in the data field of a frame of Slave 1.