Please note: this page has been translated automatically. If you can, you should read it in one of these languages:

The main thing

flash_cc2531

flash_cc2531 enables you to program your CC2531 USB stick of your Raspberry, without the need for Arduino or A CC Debugger.

Prerequisite

You need either Raspberry or Odroid-c2.
You need what to connect the debug port of the key to the GPIO ports of Raspberry, for example one cable CC and four lines Dupont (see further).
WiringPi must be installed (if it’s not pre-installed, you can usually install it with sudo apt install wiringpi), otherwise see the site of Gordon or this alternative site ).
Finally you need the software:

I’ve created flash_cc2531 on Raspberry Pi 3 with raspbian, but successful programming was reported on other models:

Preparation

Download flash_cc2531 to your raspberry :

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

Connect the following pins of the debug port to the GPIO port:

GPIO pin CC pin
39 ( GND ) 1 ( GND )
36 ( wPi 27, BCM16 ) 3 ( DC )
38 ( wPi 28, BCM20 ) 4 ( DD )
35 ( wPi 24, BCM19 ) 7 ( reset )

The pin layout of raspberry is available here: https://pinout.xyz/

Then enter the USB key into port.
Note: If you do not want to insert the key in a USB port, you can instead connect the pin CC 9 to one pin 3,3v of raspberry ( Pin 1 or 17 ).

Download-cable CC and 4 Dupont lines female to female are perfect for this purpose: stick and _raspberry_ This is my favorite option, but if you don’t have a cable CC you can also directly solder the cables Dupont on the key: see for example the website lemariva.com or notenoughtech.com

try this:

cd flash_cc2531
./cc_chipid

It must return:

  ID = b524.

(the value may be different if the hardware version of your key is not the same as mine).
If you see 0000 or ffff something is incorrect:

usage

To save the contents of the flash memory to the save.hex file:

./cc_read save.hex

(takes about 2 minutes).

To erase flash memory:

./cc_erase

Note: You must erase before writing (unless you really know what you are going to do).

To program the file CC2531ZNP-Prod.hex on the key CC2531:

./cc_write CC2531ZNP-Prod.hex

(lasts about 3 minutes).

Use other pins

all commands accept the following arguments:

the pin numbering used is that of wiringPi. Use gpio readall to have the layout in your Raspberry (column wPi ).

For example, if you want to use pins 3, 11 and 13:
Connect the following pins of debug port to GPIO port:

  1. pin 1 ( GND ) -> pin 14 ( GND )

  2. pin 7 ( reset ) -> pin 3 ( wPi 8, BCM2 )

  3. pin 3 ( DC ) -> pin 11 ( wPi 0, BCM17 )

  4. pin 4 ( DD ) -> pin 13 ( wPi 2, BCM27 )

and now you can read identifier, save, delete and write flash memory with the following commands:

./cc_chipid -r 8 -c 0 -d 2
./cc_read -r 8 -c 0 -d 2 save.hex
./cc_erase -r 8 -c 0 -d 2
./cc_write -r 8 -c 0 -d 2 CC2531ZNP-Prod.hex

what if it doesn’t work?

  1. stop all other programs.

  2. fix the processor speed before programming. Example:

    sudo echo performance >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    
  3. use the -m option to increase the time limits used. Example:

    ./cc_write -m 300 CC2531ZNP-Prod.hex
    
  4. recompile the program with make.

  5. look for a solution in the questions already asked on github

  6. Ask your own question about github.

  7. Check your nutrition block

    grep Under /var/log/kern.log
    

    If you get a lot of lines then you have to change nutrition block.

I want to connect more than 15 periphery

We read in different locations that the key CC2531 can only handle 15 maximum appliances.
In fact, the standard firmware of this key has a limit of 15 direct links. But if one of these connections is zigbee router ( and most devices work as a router, that is, for example, the case of Philips Hue bulbs and Ikea TRÅDFRI bulb ), then the CC2531 can manage the Devices behind this router, and those behind the router connected to this router …
In fact, the limit for the CC2531 is much higher. And if one day you exceed more than 50 devices on your zigbee Network, investing in a more expensive coordinator will be just a small part of your budget.
Also note that the protocol zigbee limits the number of direct links to 32th. Regardless of your coordinator zigbee, it will not be possible to connect to more than 32 peripherals.

My key has its red LED that illuminates.

It happens that the key deprograms, either due to the environment loaded by parasites or due to poor nutrition.

  1. Check your nutrition block

    grep Under /var/log/kern.log
    

    If you get a lot of lines then you have to change nutrition block.

  2. Get away the key to disturbing materials: speakers, Wi-Fi router, …

  3. Reprogram the key

License

This project is licensed under the GPL v3 ( see COPYING ).