Flash CC2531 using a Raspberry PI 4

CC2531USB
Many guides exist describing how to flash a CC2531 USB adapter using a Raspberry Pi instead of a CC debugger. The problem with almost all of those guides is that they are outdated and don’t work on newer devices (specifically with 64 bit architecture). Most of the times the issues have to do with outdated version of wiring PI, or the precompiled for 32 bit devices cc_* binaries (cc_chipid, cc_read, cc_write). In this guide you will learn how to flash CC2531 using a Raspberry PI 4 or any other device with 64 bit architecture OS.

Preparation

You can follow any of the existing guides of how to connect the CC2531 to the Raspberry PI like the one from notenoughtech or the one from the author of flash_cc2531 Jean Michault (requires a simple adapter for the different pitch of the pins between raspberry pi board and CC2531).

Flashing the adapter

As already mention all you need to flash the CC2531 USB Adapter is wiringpi and flash_cc2531. The only prerequite, if you are using Raspberry Pi OS Lite (64bit) (Released on May 3rd 2023), is git which you can install using the command:

sudo apt install -y git

wiringpi

You can download the latest version (2.61-1 as of writing) of wiringpi for 64 bit architecture from here which is an unofficial but the most recently updated fork after the end of official development from the original author.
Then install it by simply running:

sudo dpkg -i wiringpi-2.61-1-arm64.deb

When the installation complete you can verify that it was correctly installed by running:

gpio -v

wiringpi 2.61 gpio

flash_cc2531

Clone the original repository from github using the command:

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

enter in the directory of the cloned repo:

cd flash_cc2531

and then recompile it for the ARM aarch64 architecture using the command:

make

After recompiling check that your device was wired correctly by running the command:

./cc_chipid

If everything was wired correctly then you should get:

ID = b524

Flash CC2531 with the new firmware

At this point you can again follow any of the other guides as nothing changes in the remaining procedure. You have to download the latest available version of the firmware (CC2531 as Coordinator Device Available here
using the command:

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

unzip it running:

unzip CC2531_DEFAULT_20211115.zip

erase the previous firmware from the device:

./cc_erase

and install the new firmware:

./cc_write CC2531ZNP-Prod.hex

Writing of the new firmware usually takes about 3 min to complete. When it finishes you can remove the cables from the GPIO pins of Raspberry PI and start using your CC2531 coordinator..

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments