Introduction
I recently updated the firmware on my Sonoff Zigbee USB Dongle Plus device. It wasn't the easiest process but the results were a big improvement in range and reliability from the firmware version that came on the device.
I watched a YouTube video showing the procedure using a Windows PC with Python. So I migrated the information and procedure over to Debian Linux.
Coordinator
The coordinator is a critical component of a Zigbee network, responsible for initiating and managing the network. There is only one coordinator per network, and it assigns unique addresses to each device, maintains routing tables, and controls overall network operation.
Router
Routers are Zigbee devices that can relay data between other devices in the network. They have the ability to extend the range of the network by acting as intermediaries between devices that are not within direct communication range of each other.
Links
Bootloader
https://github.com/JelmerT/cc2538-bsl
Z Stack Firmware - coordinator
https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_3.x.0/bin
Z Stack Firmware - router
https://github.com/Koenkk/Z-Stack-firmware/tree/master/router/Z-Stack_3.x.0/bin
Install required software
sudo nala install -y python3
sudo nala install -y python3-pip
Fix some parameters
sudo rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED
echo export PATH="$HOME/.local/bin:$PATH" >> ~/.config/zsh/.zprofile
Log out and then back in for PATH change to take effect.
Install required Python plugins
pip3 install intelhex
pip3 install pyserial
pip3 install python-magic
pip3 install wheel
pip3 install zigpy-znp
Check device and add user to correct group
ls -aFl /dev/ttyUSB0
sudo usermod -a -G dialout $USER
Download and unpack the Bootloader software
curl -LSso master.zip https://github.com/JelmerT/cc2538-bsl/archive/refs/heads/master.zip
unzip master.zip
mv cc2538-bsl-master bootloader
rm master.zip
Download and unpack the coordinator software
curl https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20240710.zip
unzip CC1352P2_CC2652P_launchpad_coordinator_20240710.zip
mv *.hex bootloader
rm CC1352P2_CC2652P_launchpad_coordinator_20240710.zip
Stop mosquitto and zigbee2mqtt containers (if running)
docker stop mosquitto
docker stop zigbee2mqtt
Change permissions on ttyUSB0 (resets on reboot)
sudo chmod 777 /dev/ttyUSB0
sudo chown $USER:$USER /dev/ttyUSB0
Make a backup of existing firmware
python3 -m zigpy_znp.tools.nvram_read /dev/ttyUSB0 -o nvram_backup.json
Compress and copy backup file to laptop
cd bootloader
python3 -m zigpy_znp.tools.nvram_read /dev/ttyUSB0 -o nvram_backup.json && tar -czvf backup.tar.gz nvram_backup.json
scp backup.tar.gz user@computer:~
Install new firmware
python3 cc2538-bsl.py -p /dev/ttyUSB0 -e -v -w --bootloader-sonoff-usb CC1352P2_CC2652P_launchpad_coordinator_20240710.hex
Reboot system after flashing.