wb_editors
14 355
правок
(Новая страница: «The device loader receives firmware via Modbus RTU. In the bootloader mode, the communication parameters are fixed and do not depend on the previous values in the…») |
FuzzyBot (обсуждение | вклад) м (FuzzyBot переименовал страницу WB-MCU-Flasher/en в WB Modbus Devices Firmware Update/en без оставления перенаправления: Часть переводимой страницы WB-MCU-Flasher.) |
||
(не показано 29 промежуточных версий 1 участника) | |||
Строка 12: | Строка 12: | ||
== Entering bootloader mode == | == Entering bootloader mode == | ||
[[ | [[File:Bootloader.gif||right||Bootloader mode indication]] | ||
The device enters bootloader mode if: | The device enters bootloader mode if: | ||
* the device has the correct firmware — the first 2 seconds after power on, the device operates in bootloader mode; | * the device has the correct firmware — the first 2 seconds after power on, the device operates in bootloader mode; | ||
Строка 39: | Строка 39: | ||
The device loader receives firmware via Modbus RTU. In the bootloader mode, the communication parameters are fixed and do not depend on the previous values in the device memory: 9600 8N2. According to the Modbus protocol, the device can be set to bootloader mode, if 1 is written to the holding register 129 (0x81) during the operation of the main program. In this scenario, the device restarts and remains in bootloader mode for 120 seconds. | The device loader receives firmware via Modbus RTU. In the bootloader mode, the communication parameters are fixed and do not depend on the previous values in the device memory: 9600 8N2. According to the Modbus protocol, the device can be set to bootloader mode, if 1 is written to the holding register 129 (0x81) during the operation of the main program. In this scenario, the device restarts and remains in bootloader mode for 120 seconds. | ||
Modbus | The Modbus address of the bootloader firmware device should be selected as follows: | ||
# | # The main address for the firmware is the address specified in the device memory: that is, it is the standard address to which the device responds from the main program. | ||
# | # To flash a device using a broadcast address of 0. This is a less preferred method. | ||
== | == Utility for WB-mcu-fw-flasher firmware == | ||
To transfer firmware to the devices, use the wb-mcu-fw-flasher utility launched from the Wiren Board controller (or a computer with Linux or Windows). | |||
To install the utility '''on the Wiren Board controller''', run the following commands: | |||
<pre> | <pre> | ||
apt-get update | apt-get update | ||
Строка 55: | Строка 55: | ||
</pre> | </pre> | ||
Software for '''MS Windows''' can be downloaded here: [[Media: Wb-mcu-fw-flasher_1.0.2.zip | Wb-mcu-fw-flasher_1.0.2.zip]]. | |||
To install on a '''Debian computer''', download the package from here: [[Media: Wb-mcu-fw-flasher_1.0.2_amd64-all.deb | Wb-mcu-fw-flasher_1.0.2_amd64-all.deb]] | |||
and execute commands in the directory where the package was downloaded. | |||
<pre> | <pre> | ||
apt-get update | apt-get update | ||
Строка 67: | Строка 67: | ||
wb-mcu-fw-flasher utility starting options: | |||
{| class="wikitable" | {| class="wikitable" | ||
! | ! Option !! Description !! Value by default | ||
|- | |- | ||
| -d || | | -d || serial port device || | ||
|- | |- | ||
| -f || | | -f || firmware file || | ||
|- | |- | ||
| -a || | | -a || Modbus address || 1 | ||
|- | |- | ||
| -j || | | -j || Send a command to the device to enter bootloader mode || | ||
|- | |- | ||
| -r || | | -r || Address of the holding register to enter bootloader mode || 129 | ||
|- | |- | ||
| -D || | | -D || Enable debug mode || | ||
|} | |} | ||
Строка 89: | Строка 89: | ||
</pre> | </pre> | ||
The example for Windows: | |||
<pre> | <pre> | ||
wb-mcu-fw-flasher.exe -j -d COM10 -a 25 -f WB-MR-MR6C_MCU3_3_1.9.4.wbfw | wb-mcu-fw-flasher.exe -j -d COM10 -a 25 -f WB-MR-MR6C_MCU3_3_1.9.4.wbfw | ||
</pre> | </pre> | ||
COM10 is the name of the virtual serial port that is assigned to the USB RS-485 adapter. | |||
== | == Device flashing == | ||
''' | '''When flashing from the controller, stop wb-mqtt-serial:''' | ||
<pre> | <pre> | ||
service wb-mqtt-serial stop | service wb-mqtt-serial stop | ||
</pre> | </pre> | ||
Connect the device to RS-485. | |||
If you do not know the exact hardware type of the device, you can read its signature with the command: | |||
<pre> | <pre> | ||
export mbusaddr=1; echo -e `modbus_client --debug -mrtu -pnone -s2 /dev/ttyRS485-1 -a$mbusaddr -t0x03 -r290 -c 12 | grep Data | sed -e 's/0x00/\x/g' -e 's/Data://' -e 's/s//g'`| xxd -r -p && echo '' | export mbusaddr=1; echo -e `modbus_client --debug -mrtu -pnone -s2 /dev/ttyRS485-1 -a$mbusaddr -t0x03 -r290 -c 12 | grep Data | sed -e 's/0x00/\x/g' -e 's/Data://' -e 's/s//g'`| xxd -r -p && echo '' | ||
</pre> | </pre> | ||
Specify the address of the flash device in a mbusaddr variable. | |||
In the output of the command, you will get the device signature, for example, '''wbmr6c'''. | |||
Select the appropriate firmware, for example, WB-MR-MR6C_MCU3_3_1.9.4.wbfw. | |||
Flash the device with the command: | |||
<pre> | <pre> | ||
wb-mcu-fw-flasher -j -d /dev/ttyRS485-1 -a 25 -f WB-MR-MR6C_MCU3_3_1.9.4.wbfw | wb-mcu-fw-flasher -j -d /dev/ttyRS485-1 -a 25 -f WB-MR-MR6C_MCU3_3_1.9.4.wbfw | ||
</pre> | </pre> | ||
The successful firmware process is as follows: | |||
<pre> | <pre> | ||
wb-mcu-fw-flasher -j -d /dev/ttyRS485-1 -a 1 -f WB-MR-MR6C_MCU3_3_1.9.4.wbfw | wb-mcu-fw-flasher -j -d /dev/ttyRS485-1 -a 1 -f WB-MR-MR6C_MCU3_3_1.9.4.wbfw | ||
Строка 133: | Строка 133: | ||
</pre> | </pre> | ||
''' | '''After successful flashing, the device will exit the bootloader mode itself and restart in the main program.''' | ||
The example of a signature mismatch error: | |||
<pre> | <pre> | ||
Sending info block... | Sending info block... | ||
Строка 143: | Строка 143: | ||
=== | === Firmware devices on the Modbus broadcast address 0 === | ||
Bootloader | Bootloader allows you to download firmware to devices via Modbus address 0. To do this, the device must be the only device on the bus and must be in bootloader mode. | ||
=== | === Flashing several devices on the bus === | ||
It is possible to flash several devices connected to the bus. The devices must be set to bootloader mode and flashed separately with a non-broadcast Modbus address. Flashing devices with the same address is possible if only one of them is in the bootloader mode. The devices shall be flashed at a time. | |||
''' | '''Attention!''' The flashing of the devices in bootloader mode and of the same modbus address, or the flashing of multiple devices being in the bootloader mode at address 0 will not be performed; the existing firmware of the device will be ruined. |