Riprogram the firmware of the CC2531 USB dongle via Raspberry Pi and without CC Debugger

3 minutes of reading
PURPOSES OF PROJET:
  • Riproedit the firmware of a CC2531 USB dongle (in the example we will use the version required for use with zigbee2mqtt)
  • Difficulty level: bass
CONCEPTS FACED:
  • Riprofirmware grammation
SOFTWARE COMPONENTS USED:
PHYSICAL DEVICES USED:
PROJET MOST INDICATED FOR:

All environments

Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 1.1

Abstract

Every electronic device contains broadly a small piece of softwareCalled firmware, which determines its functions and behavior. Our car is equipped with different firmware; it has one, the washing machine, our remote control, even a clock radio has a profirst firmware.

Il CC2531 USB dongle it's a small and inexpensive component which allows, combined with the software zigbee2mqtt, to define a BRIDGE/Gateway ZigBee↔︎MQTT useful for administering a network ZigBee in profirst personal home automation (and therefore accessories based on this standard); unfortunately, the component is not pronto use (as, differently, other similar components like the ConBee, which however cost more) but provides, upstream, for a reprogrammation of its firmware in order to make it operational.

This guide illustrates one of the ways of reprogrammation through a Raspberry Pi support (any model) and without the need for connection devices such as the CC Debugger and the download cable for CC2531. In case you own these components - or prefer this other technique regardless because you don't have a Raspberry Pi - the guide appropriata è this.

The guide is obviously usable also with other firmware compatible with CC2531.

It starts

Description proprocedure

La proprocedure it's really a lot, very simple. It is in fact sufficient to connect four contacts present on the CC2531 USB dongle with as many four present on the Raspberry Pi (any model, even Pi Zero), then connect the dongle to one of the USB ports of the Raspberry Pi and finally execute a specific command.

What you need to have is:

Physical connections

First of all it is necessary to connect the two devices respecting the following scheme:

PIN CC2531withPIN Raspberry Pi
GNDGND
RST35
DC36
DD38

Contacts to be interconnected via Dupont cables are the following:

ATTENZIONE: the scheme for Raspberry Pi reports that of the Raspberry 2 / 3 / 4, but the pinout is the same even on Raspberry Pi Zero

Once the pins are connected together insert the CC2531 USB dongle to one of the Raspberry USB ports, after that connect via SSH to profirst Raspberry. In case it was off, prosee to turn it on.

Riproming

WIRINGPI VERIFICATION

First of all it is necessary to check the presence of the software WiringPi. To perform this verification, from the terminal (once connected to the Raspberry via SSH), execute the following command:

gpio -v

Which should provide an answer similar to the following:

gpio version: 2.50
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

once this response is obtained, you have confirmation that you have the necessary software on board.
In case instead get an error, it will then be necessary to install the software using the command:

sudo apt-get install wiringpi
INSTALL flash_cc2531

Now you need to install the software flash_cc2531 using the command:

git clone https://github.com/jmichault/flash_cc2531.git

Once the brief installation is complete, access the "flash_cc2531”And execute the verification command:

cd flash_cc2531
./cc_chipid

In response, the command should provide the ID "b524". If it is different, check connections.

DOWNLOAD THE FIRMWARE

At this point it is necessary to download the firmware that we are interested in installing on the C2531 USB dongle. In the example below we will install the firmware Z-Stack (the most compatible and stable with zigbee2mqtt), available here. The file that interests us begins with the prefix "CC2531_DEFAULT_“, While the prefix varies with respect to the compilation date.

Run then:

cd ~/flash_cc2531
wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_Home_1.2/bin/CC2531_DEFAULT_XXXXXXXX.zip

taking care to adjust the command based on the name of the file available on the repository

Example: with file name "CC2531_DEFAULT_20190608.zip", The final command is:

wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_Home_1.2/bin/default/CC2531_DEFAULT_20190608.zip

Finally, run the unzip:

unzip CC2531_DEFAULT_20190608.zip

always adapting the file name.

RIPROming

Now we can execute the two commands necessary for the riprogrammation, the first to erase the dongle's memory and the second to rewrite itproprogram:

./cc_erase
./cc_write CC2531ZNP-Prod.hex

Finished the procedura, the CC2531 USB dongle will be pronto use with zigbee2mqtt.

DISCONNECTION

To finish the procedura, disconnect the dongle from the USB port and then disconnect the Dupont cables.


telegram

Stay up to date through ours Telegram channel!