W-Modbus is designed to be simple to use, requiring little control from an external CPU.
Commissioning a W-Modbus system is performed in the following steps:
Set the W-Modbus module connected to the master/client device to the "Commissioning Gateway" application mode via the SPI interface.
Set the W-Modbus modules connected to the slave/server devices to the "Commissioning Mesh" application mode via the SPI interface.
Mesh nodes will join the gateway node and receive configuration. The mesh nodes can be polled via the SPI interface by reading the STATUS register and checking the COMMISSIONING bit. Once the bit reads as 1 the node is ready. A node takes approximately one minute to fully join the network
(Optional) UART configuration can be written to the gateway node via the SPI interface at this point. Any UART configuration written to the gateway node acts as the default UART settings for all nodes in the network and will apply to all mesh nodes connected to the gateway. UART configuration written to a mesh node will only affect that specific node.
(Optional) Once all mesh nodes are ready, as indicated by the COMMISSIONING bit, the system can be tested with modbus traffic, the modbus master/client device can poll slave/server devices and receive responses.
Set the W-Modbus module connected to the master/client device to the "Secure Gateway" application mode via the SPI interface. All nodes on the network will perform a synchronized restart in 10 seconds, where the node connected to the master/client device will enter "Secure Gateway" mode while all nodes connected to the slave/server devices will enter "Secure Mesh" mode.
Once the synchronized restart is completed the commissioning process is complete!
If no UART configuration was written to the gateway node previously, it must be written after the commissioning process.
Removing a node from a network is done by writing the value 1 to the COMMISSIONING bit in the STATUS register. The node will restart automatically, at which point the commissioning process can be started again.
The network does not have to be in commissioning mode when writing any form of configuration.
When UART configuration is written to a gateway node the configuration will apply to the gateway node, however it will also act as a default setting for all modules in the network.
Mesh nodes behave differently in that when UART configuration is written to a mesh node the configuration only applies to the individual unit, allowing modbus devices with different UART configuration to join a modbus network.
Detection of connected device¶
A W-Modbus module in mesh mode will start scanning for connected devices on startup and progressively scan from address 1 through 247, starting over until a device is found. Once a slave/server device has been detected the scanning will stop until the module is restarted.
The detection of slave/server devices is made by attempting to read a HREG (Function code 3) at address 0 of the connected modbus device. Any modbus device of class 0 or higher will be detected with their response, either via the register value result or exception code.
Polling the MODBUS_STATUS register will show whether the connected node has been found.