Hello! The ModBus spec papers sometimes don't clearly define things or don't define at all. We came to a point where we are not sure about the slave address handling. Perhaps someone from here can help.
ModBus is a protocol that can be used over many different lines. We only use USB or Ethernet, so our slave device has a point-to-point connection and the slave address doesn't matter and thus they all use the same. For a specific reason we restricted the use of the address in byte 0 of a ModBus RTU message to 0 and 1. Slave address 0 seems to be a no-go, though the spec only defines this for serial line as "it can't be zero". But how to deal with illegal addresses? That's why I have some questions:
ModBus RTU:
When a slave supports to put either 0 or 1 into the slave address byte, how it's supposed to react when there is a 2 or higher in the message? Shall it not react at all or shall it reply with an error message? If error message, what code? We couldn't find a suitable one.
ModBus TCP:
The unit identifier in the MBAP header, is it mandatory to accept any number between 0 and 255 or not? Since our slave is point-to-point only, it won't be addressed by that identifier, so it will ignore. In the same way we only accept to put 0 or 1 as address with RTU, we also defined to accept only 0 and 1 as identifier with TCP, just for the case that any ready-to-use ModBus library or software on the market would automatically put a 1 into that byte.
Thanks in advance.
ModBus is a protocol that can be used over many different lines. We only use USB or Ethernet, so our slave device has a point-to-point connection and the slave address doesn't matter and thus they all use the same. For a specific reason we restricted the use of the address in byte 0 of a ModBus RTU message to 0 and 1. Slave address 0 seems to be a no-go, though the spec only defines this for serial line as "it can't be zero". But how to deal with illegal addresses? That's why I have some questions:
ModBus RTU:
When a slave supports to put either 0 or 1 into the slave address byte, how it's supposed to react when there is a 2 or higher in the message? Shall it not react at all or shall it reply with an error message? If error message, what code? We couldn't find a suitable one.
ModBus TCP:
The unit identifier in the MBAP header, is it mandatory to accept any number between 0 and 255 or not? Since our slave is point-to-point only, it won't be addressed by that identifier, so it will ignore. In the same way we only accept to put 0 or 1 as address with RTU, we also defined to accept only 0 and 1 as identifier with TCP, just for the case that any ready-to-use ModBus library or software on the market would automatically put a 1 into that byte.
Thanks in advance.