PURPOSES OF PROJET:
SOFTWARE COMPONENTS USED:
PHYSICAL DEVICES USED:
PROJET MOST INDICATED FOR:
Notes and disclaimer
|Driving review: 1.1|
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.
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:
- un Raspberry Pi, any model, with an operating system Raspbian (if you use another system it is necessary have a microSD card of appOggio on which to install Raspbian to perform the proprocedure);
- four Dupont cables female / female.
First of all it is necessary to connect the two devices respecting the following scheme:
|PIN CC2531||with||PIN Raspberry Pi|
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.
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:
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
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.
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:
Finally, run the unzip:
always adapting the file name.
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.
To finish the procedura, disconnect the dongle from the USB port and then disconnect the Dupont cables.