16 284
правки
(Новая страница: «In slow scanning, a script is used that iterates through all possible addresses on the bus and waits for a response from them within a certain time frame. The process takes several minutes and depends on the communication settings of the devices: speed, stop bits, etc. The slow scanning mode is preserved to support devices with older firmware versions.») Метки: правка с мобильного устройства правка из мобильной версии |
|||
(не показано 11 промежуточных версий этого же участника) | |||
Строка 93: | Строка 93: | ||
In slow scanning, a script is used that iterates through all possible addresses on the bus and waits for a response from them within a certain time frame. The process takes several minutes and depends on the communication settings of the devices: speed, stop bits, etc. The slow scanning mode is preserved to support devices with older firmware versions. | In slow scanning, a script is used that iterates through all possible addresses on the bus and waits for a response from them within a certain time frame. The process takes several minutes and depends on the communication settings of the devices: speed, stop bits, etc. The slow scanning mode is preserved to support devices with older firmware versions. | ||
Quick scanning is performed much faster and allows to detect devices supporting Fast Modbus almost instantly. In quick scanning mode, the master sends a broadcast request to the bus, and devices respond with data about themselves one by one. The order is determined by the arbitration. | |||
The scanning function is available in the controller's web interface under the section '''Settings → Scanning'''. | |||
Current scanning capabilities in the web interface: | |||
*displaying all Wiren Board devices connected to the controller, | |||
* | *detecting devices with identical addresses on the same bus, | ||
* | *detecting devices with different communication parameters on the same bus. | ||
* | |||
When the scanning function is launched in the controller's web interface, it first performs a quick scan, followed by a slow scan. This can be observed in the scanning status. | |||
===Changing Modbus Device Addresses=== | |||
For devices that support Fast Modbus, you can set new addresses by accessing the device using its unique serial number. This is convenient when multiple devices with the same address are detected on the bus. | |||
Changing addresses is done using the ''wb-modbus-scanner'' utility and is currently not supported through the web interface. Detailed commands and the reference implementation of the utility are available in the [https://github.com/wirenboard/wb-modbus-ext-scanner utility's repository]. | |||
To change the device's address, connect to the controller via [[SSH]]. | |||
# Install the utility using the command: | |||
# | |||
#:<syntaxhighlight lang="bash"> | #:<syntaxhighlight lang="bash"> | ||
apt update && apt install wb-modbus-ext-scanner | apt update && apt install wb-modbus-ext-scanner | ||
</syntaxhighlight> | </syntaxhighlight> | ||
# | # Stop the wb-mqtt-serial driver using the command: | ||
#:<syntaxhighlight lang="bash"> | #:<syntaxhighlight lang="bash"> | ||
systemctl stop wb-mqtt-serial | systemctl stop wb-mqtt-serial | ||
</syntaxhighlight> | </syntaxhighlight> | ||
# | # Execute the command: | ||
#:<syntaxhighlight lang="bash"> | #:<syntaxhighlight lang="bash"> | ||
wb-modbus-scanner -d /dev/ttyRS485-1 -b 115200 -s 4267937719 -i 3 | wb-modbus-scanner -d /dev/ttyRS485-1 -b 115200 -s 4267937719 -i 3 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
# | # Where, /dev/ttyRS485-1 is the port to which the device is connected, 115200 is the exchange rate, 4267937719 is the device's serial number, 3 is the new slave ID. | ||
# As a result, the following output should appear: | |||
# | |||
#:<syntaxhighlight lang="bash"> | #:<syntaxhighlight lang="bash"> | ||
Serial port: /dev/ttyRS485-1 | Serial port: /dev/ttyRS485-1 | ||
Строка 145: | Строка 129: | ||
Change ID for device with serial 4267937719 [FE638FB7] New ID: 3 | Change ID for device with serial 4267937719 [FE638FB7] New ID: 3 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
# | # Start the wb-mqtt-serial driver again using the command: | ||
#:<syntaxhighlight lang="bash"> | #:<syntaxhighlight lang="bash"> | ||
systemctl start wb-mqtt-serial | systemctl start wb-mqtt-serial | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Support for scanning in firmware === | |||
{| border="1" class="wikitable" | |||
! Device || Firmware version where scanning was introduced | |||
|- | |- | ||
| WB-MRx, WB-MWAC | | WB-MRx, WB-MWAC | ||
| 1.19.0 | | 1.19.0 | ||
|- | |- | ||
| WB-MDM3 | | WB-MDM3 | ||
| 2.6.0 | | 2.6.0 | ||
|- | |- | ||
| WB-LED, WB-MRGBW-D | | WB-LED, WB-MRGBW-D | ||
| 3.2.0 | | 3.2.0 | ||
|- | |- | ||
| WB-MSx, WB-MSWx, WB-MIR, WB-M1W2 | | WB-MSx, WB-MSWx, WB-MIR, WB-M1W2 | ||
| 4.23.0 | | 4.23.0 | ||
|- | |- | ||
| WB-MAI11 | | WB-MAI11 | ||
| | | not supported | ||
|- | |- | ||
| WB-MAI6 | | WB-MAI6 | ||
| 2.0.0 | | 2.0.0 | ||
|- | |- | ||
| WB-MAO4 | | WB-MAO4 | ||
| 2.2.0 | | 2.2.0 | ||
|- | |- | ||
| WB-MAPx | | WB-MAPx | ||
| 2.4.0 | | 2.4.0 | ||
|- | |- | ||
| WB-MIO | | WB-MIO | ||
| 1.6.0 | | 1.6.0 | ||
|- | |- | ||
| WB-REF-U | | WB-REF-U | ||
| 1.4.0 | | 1.4.0 | ||
|- | |- | ||
| WB-REF-DF | | WB-REF-DF | ||
| 1.1.0 | | 1.1.0 | ||
|- | |- | ||
|} | |} | ||
==Useful links== | |||
* [https://habr.com/p/772308/ Upgrading Modbus: arbitration, bus scanning, events] - an article with details on implementing the extension | |||
* [https://habr.com/p/772308/ | * [https://github.com/wirenboard/wb-modbus-ext-scanner/blob/main/protocol.md Extension description on GitHub] | ||
* [https://github.com/wirenboard/wb-modbus-ext-scanner/blob/main/protocol.md | * [[Modbus | Modbus protocol description]] | ||
* [[Modbus | | * [https://github.com/wirenboard/wb-modbus-ext-scanner Scanning utility repository] | ||
* [https://github.com/wirenboard/wb-modbus-ext-scanner | |||