Flash Firmware using JelmerT's serial bootload tool¶
JelmerT's serial bootload toolis a cross-platform Python script that allows you to flash firmware on TI's newer chips.
All ZigStar boards are supported by cc2538-bsl.py.
Installation¶
- Install python
- Use
python --version
to be sure, that you are running python 3 or above! - If you are NOT running 3.4 or higher, you need to install
pip
, too. - Install dependencies with
pip install pyserial intelhex
- Download the [cc2538-bsl.py] file or just clone the repo.
Copy and paste the command into your terminal.
Python3 should already be shipped with macOS,if no then follow below procedure:
Download and extract cc2538-bsl:
Install required dependencies:Download Python for Windowsand install. After installation verify Python if its installed by running python -V
in Command Prompt.
If you receive a message similar to Python is not recognized as an internal or external command, operable program or batch file.
, this means Python is either not installed or the system variable PATH hasn’t been set. You’ll need to launch Python from the folder in which it is installed or adjust your system variables to allow it to be launched from any location.
Download the zipped codeand extract to a folder.
Install required dependencies:
Tip
Please use the Power Shellto have the best user experience. If you encounter permissions issues, ensure that you are running your terminal as an administrator.
Determine the USB port/ IP address¶
Plug your device in and ensure that device is recognised by your OS:
On linux, use this:
Issuedmesg
and observe the device enumeration: [152343.203201] usb 1-1.4: new full-speed USB device number 5 using dwc_otg
[152343.336384] usb 1-1.4: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.62
[152343.336400] usb 1-1.4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[152343.336409] usb 1-1.4: Product: USB2.0-Serial
[152343.338315] ch341 1-1.4:1.0: ch341-uart converter detected
[152343.341440] usb 1-1.4: ch341-uart converter now attached to ttyUSB0
On macOS find the device using:
Issuedmesg
and observe the device enumeration: On windows, use this in a Powershell or go to Device Manager
$comports = Get-WMIObject Win32_SerialPort; $comports | Get-PnpDeviceProperty -InstanceId {$_.pnpdeviceid} -Keyname DEVPKEY_Device_BusReportedDeviceDesc | ForEach-Object { foreach($comport in $comports) { if ($comport.pnpdeviceid -eq $_.instanceid) { new-object psobject -property @{COMPORT = $comport.deviceid; 'Device-Name' = $_.data} } } }
If you need to install the drivers manually, go HEREfor official drivers.
Tip
Double-check by undocking the device again.
Info
For network device find out IP or hostname.
Put your device in BSL mode¶
Please follow the following instructions to put your device in BSL mode:
- Unplug your stick from the host
-
Press the
BSL/FLASH
pushbutton and keep holding while plugging the device back into the host -
Give it a few seconds for the device to settle and set up and release the BSL button
- Your stick should now be in ROM bootloader mode
It's very important that you press and hold the BSL button before plugging it in to the host and release it after a few seconds.
Note
cc2538-bsl.py and .exe supports "Auto-BSL", now you can skip the BSL pushbutton press for flashing boards.
Just follow normal firmware procedure using cc2538-bsl.py or cc2538-bsl.exe. ( Boards using CH340E does not support Auto-BSL! )
- Access device by IP or hostname using your browser
- Click Firmware Update initiate the bootloader (BSL) mode for the module:
- Watch the Debug output and when promted go to next step.
Flash firmware¶
To flash firmware, run:
PORT
is the serial port your board is connected to. (see above) and FIRMWARE
is the hex file you want to flash (see here for help on choosing firmware).
Info
-p: will select the port
-evw: will erase,write and check firmware
Warning
It is crucial that you download the correct firmware for your stick as using the wrong firmware will disable the BSL and you will need an external debugger / programmer to flash your stick again.
Additional:¶
Erase device¶
To completely erase the device flash, run:
Clearing NVRAM¶
During the flashing process, the coordinator's memory (NVMEM) may contain arbitrary data, which may in some cases prevent NVMEM recovery from the backup.
The coordinator's memory is cleared by the zStackEraseAllNvMem.js
script, which is usually located in this directory:
Download and install zigpy-znp:
Erase your device's NVRAM entries to fully reset it: Some warnings are normal, as not all entries will be present in every device.Info
At the end of the flashing, you may need to unplug-plug your device or press RST.