Schlagwort-Archive: Raspberry Pi

Fashing Z-Stack on a CC2530 with only a Raspberry Pi

Preparations

Hardwarewise you only need your CC2530 board, a Rasperry Pi which is newer than the first version and a bunch of (preferably) female-female cables. This does not work for Raspberry Pi 1 as it doesn’t have the required GPIOs.

From a software point of view, you would need to have WiringPi installed and have the according coordinator or repeater firmware ready. This will be explained in the later process.

Wiring

First of all, hook up your CC2530 with your Raspberry Pi. Therefore connect the following PINs.

CC2530
GND or G
VCC
RES or RST or R (reset)
P22 (DC)
P21 (DD)

Raspberry Pi
Pin 39 (GND)
Pin 01 (3.3V)
Pin 35 (GPIO24, BCM19)
Pin 36 (GPIO27, BCM16)
Pin 38 (GPIO28, BCM20)

Flashing the CC2530

Make sure you have WiringPi installed. If not, follow these steps.

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

This should now contact the CC2530 board and return the chip id. If this return something like 0000 or ffff you have to go back and check the wiring! The result should be

  ID = b524.

Usually you will find an expected result of „a524“ on the internet. This is also a valid result, but for the USB stick type of hardware. In case you are having a CC2531, you will get „a524“ as a result. But then I would be impressed, as the wiring should be different.

Afterwards download the coordinator software and unzip it

wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.0.x/bin/CC2530_20190523.zip
unzip CC2530_20190523.zip

Now erase the chip

sudo ./cc_erase

This will give you something like
ID = a524.
erase result = 00a2.
as a result. The chip can now be programmed with the coordinator firmware using the following command

sudo ./cc_write CC2530ZNP-with-SBL.hex

The expected result would be

  ID = a524.
  reading line 15490.
  file loaded (15497 lines read).
writing page 128/128.
verifying page 128/128.
 flash OK.

This should give you a fully functional Z-Stack coordinator. This now needs to be hooked up to either your Raspberry or maybe even a ESP8266 to be used. Or connect it to a zigbee2mqtt server.

References

  • https://www.raspberrypi.org/documentation/usage/gpio/images/GPIO-Pinout-Diagram-2.png
  • https://ptvo.info/how-to-select-and-flash-cc2530-144/
  • https://www.zigbee2mqtt.io/