In this tutorial we’ll be flashing the ZBDongle-P with the latest coordinator firmware — Without having to open the case.
We’ll walk you through the steps to upgrade the firmware on your Sonoff Zigbee 3.0 (ZBDongle-P).
Install Python requirements
Assuming python3 is installed. Don’t have python installed? I recommend using brew to install it.
pip3 install pyserial intelhex
Download and extract cc2538-bsl
cc2538-bsl is a python script that communicates with the boot loader of the Texas Instruments CC2538, CC26xx and CC13xx SoCs (System on Chips). It can be used to erase, program, verify and read the flash of those SoCs with a simple USB to serial converter.
mkdir cc2538-bsl cd cc2538-bsl curl -sSL https://github.com/JelmerT/cc2538-bsl/archive/refs/heads/master.tar.gz | tar xz --strip 1
Download and flash the firmware
Latest firmware at the time of writing (oktober 2022): 20220219
Check this github folder for updates.
First we need to know the port the ZBDongle-P is connected to. The easiest way to do this is by checking the connected usb tty devices like so:
ls /dev/tty* | grep usb
If it outputs more than one, try disconnecting it and running it again, see what changes 😉
Then it’s time to download and extract the firmware into the current directory:
wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20220219.zip unzip CC1352P2_CC2652P_launchpad_coordinator_20220219.zip python3 cc2538-bsl.py -ewv -p /dev/tty.usbserial-0001 --bootloader-sonoff-usb ./CC1352P2_CC2652P_launchpad_coordinator_20220219.hex
/dev/tty.usbserial-0001 with your own port.
-ewv means Mass erase, write, verify
-p is the port on which your device is running, in this case
--bootloader-sonoff-usb means that the bootloader is activated by the script, by toggeling RTS and DTR in the correct pattern for Sonoff USB dongle (remove this if your device is not a Sonoff dongle).
If the flash process was successfully done, an output like this appears:
Opening port /dev/ttyUSB0, baud 500000 Reading data from ../CC1352P2_CC2652P_launchpad_coordinator_20220219.hex Your firmware looks like an Intel Hex file Connecting to target... CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8 Primary IEEE Address: 00:00:00:00:00:00:00:00 Performing mass erase Erasing all main bank flash sectors Erase done Writing 360448 bytes starting at address 0x00000000 Write 104 bytes at 0x00057F988 Write done Verifying by comparing CRC32 calculations. Verified (match: 0xe0c256fd)
🎉 Congratulations, you’ve successfully flashed the latest firmware!