John-Mark Gurney 1725f515f5 | 4 years ago | |
---|---|---|
.gitignore | 4 years ago | |
CCDebugger.c | 4 years ago | |
CCDebugger.h | 4 years ago | |
LICENSE | 5 years ago | |
Makefile | 4 years ago | |
README.md | 4 years ago | |
cc_chipid.c | 5 years ago | |
cc_erase.c | 5 years ago | |
cc_read.c | 4 years ago | |
cc_write.c | 4 years ago | |
wiringPi.c | 4 years ago | |
wiringPi.h | 4 years ago |
flash CC2531 USB dongle from your Raspberry, without Arduino nor CC Debugger.
You need a Raspberry or an Odroid-c2.
WiringPi must be installed (if it is not preinstalled, you can usually install it with sudo apt-install install wiringpi
).
I have designed flash_cc2531 on a Raspberry Pi 3 with raspbian, but successful flashes have been reported on pi 1 and pi 2 : see sections use other pins and what to try if it doesn’t work.
Download flash_cc2531 on your raspberry:
git clone https://github.com/jmichault/flash_cc2531.git
Connect the following pins of the debug port to the GPIO port :
and insert the usb dongle in a port.
A downloader cable CC and 4 Dupont line Female to Female are perfect for this purpose :
test by running :
cd flash_cc2531
./cc_chipid
it should return :
ID = b524.
If you see 0000 or ffff, something is wrong and you should probably check your wiring.
To save the content of the flash to save.hex file :
./cc_read save.hex
(takes around 1 minute).
To erase the flash :
./cc_erase
Note : You must erase before writing.
To flash file to cc2531 :
./cc_write CC2531ZNP-Prod.hex
(takes around 3 minutes).
all commands accept following arguments :
-c pin : change pin_DC (default 27)
-d pin : change pin_DD (default 28)
-r pin : change reset pin (default 24)
-m : change multiplier for time delay (default auto)
the pin numbering used is that of wiringPi. Use “gpio readall” to have the layout on your pi (wPi column).
example, if you want to use pins 3, 11 and 13 : Connect the following pins of the debug port to the GPIO port :
and now you can read chip id, save flash content, erase flash, and write flash with 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
You can also change default values in CCDebugger.h and recompile executables with make.
sudo bash
echo performance >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
exit
./cc_write -m 300 CC2531ZNP-Prod.hex
This project is licensed under the GPL v3 license (see COPYING).