Skip to content

Functional description

W-Modbus is designed to be simple to use, in that it requires little intervention from an external CPU.

Commissioning

Commissioning a W-Modbus system is performed in the following steps:

  1. Put the W-Modbus module connected to the Modbus Master into "Commissioning Gateway" mode via the SPI or UART management interfaces.

  2. Put the W-Modbus modules connected to the Slave devices into "Commissioning Mesh" mode via the SPI or UART management interface.

  3. Devices in mesh commissioning mode will join the gateway node and receive network credentials. In order to determine when this has happened, the COMMISSIONING field/register can be read via the SPI or UART management interfaces. When the value of COMMISSIONING is 1, the mesh node is ready. A mesh node usually takes around one minute to fully join the network, but this process can take longer depending on the physical environment (like walls and radio interference).

  4. Optional: The RS485 bus communication parameters can be configured via the SPI or UART management interface. Any RS485 configuration written to the gateway node acts as the default for all mesh nodes in the network. Mesh nodes with a locally set RS485 configuration will ignore this default. RS485 configuration written to a mesh node will only affect that one mesh node. The RS485 configuration can be written during both the commissioning and secure network states.

  5. Optional: Once all mesh nodes are ready, as indicated by the COMMISSIONING field/register, the system can be validated by having the Modbus Master device poll Modbus Slave devices as if the Modbus devices were connected by a cable.

  6. Set the W-Modbus module connected to the Master device to "Secure Gateway" mode via the SPI or UART management interface. At this point, the Gateway will broadcast a message to all mesh nodes in the network, instructing all devices to perform a synchronized restart after 10 seconds. After the restart has been performed, the W-Modbus Commissioning Gateway will enter "Secure Gateway" mode, and all connected Commissioning Mesh nodes will enter "Secure Mesh" mode. The commissioning process is now complete. The mesh nodes will search for the gateway again after the synchronized restart, and communicate securely using encryption, until explicitly decommissioned.

Decommissioning

Decommissioning a mesh node from a network can be done by utilizing the DEVICE_RESET field/register using the SPI or UART management interfaces. The node will restart automatically, at which point the device can be commissioned again.

To decommission an entire mesh network at once, put the Secure Gateway into "Gateway Commissioning" mode. The gateway will send a broadcast, instructing currently connected nodes in the network to decommission. In the same manner as described in the Commissioning section, this broadcast also makes connected mesh nodes perform a synchronized restart 10 seconds after receiving the broadcast. After the synchronized restart, each connected mesh node will switch to commissioning mesh mode.

RS485 bus configuration

The writing of RS485 configuration to the W-Modbus device can be done regardless of the current app mode.

An RS485 configuration written to a gateway node applies not only to itself, but also acts as the default for mesh nodes in the network. The default can be overridden, by writing RS485 configurations to mesh nodes individually. Mesh nodes other than the one being written will be unaffected. This feature allows Modbus devices with differing RS485 configuration to communicate in the same Modbus network.

NOTE: Individually written RS485 configurations, called local configurations, are lost on restarts, meaning the default RS485 configuration set on the gateway node will be used instead.

Detection of connected device

A W-Modbus mesh node, after booting, will begin scanning for connected devices on addresses 1 through 255. Devices that respond are added to a list at the end of a scan cycle. A maximum of 16 devices are supported with the current version of the firmware. Scanning will repeat as long as the device has power, meaning devices will be automatically added/removed depending their connectivity. The first repeat is done after a minute, and as long as the list of addresses is not empty and unchanged, the repeat interval is doubled until it reaches 16 minutes. If the list of addresses changes or is empty, the repeat interval is reset to 1 minute.

To scan for a slave/server device, the W-Modbus Module will send read commands on the RS485 bus, requesting the value of the HREG (Function code 3) at register address 0. This command is repeated for all possible Modbus addresses. Any Modbus device of class 0 or higher is expected to respond to this read command, either with a register value or a Modbus exception.

To find which devices the W-Modbus Module have found so far, the SERVER_ADDRESSES field/register can be polled via the SPI or UART management interfaces. Note that SERVER_ADDRESSES won't be updated until after a full scan cycle is completed.

Back to top