Introduction
Crazyradio is an open-source 2.4GHz radio dongle originally intended for communicating with Crazyflie. Being open-source it is designed to be hacked, enhanced for its designed purpose and modified for other.
There is one trick though: the way the Crazyradio USB bootloader is setup is not safe against bugged firmware: the bootloader is launched by the firmware so if the firmware is bugged or damaged launching the bootloader might become impossible.
The solution is then to have an SPI programmer, this article describe how to use your Raspberry Pi as an SPI programmer to recover the USB bootloader. This allows to work with the Crazyradio without the fear of locking it up.
Preparing your Raspberry Pi
This has been tested on both Raspberry Pi 2 and 3. The pin used where present on all Raspberry Pis, including the first one, so it should work on Raspberry Pi 1 as well but it has not been tested.
You need to run a recent version of raspian (at least newer than December 2016). To clone the project, run the flashing script and the bootloader script, some additional packages are needed. You can install them by running the following in a console:
$ sudo apt-get install git python-usb
Cabling the Crazyradio and Raspberry pi
The Crazyradio expansion port needs to be fitted with a 2×5 Pin connector and connected to the Raspberry Pi expansion connector.
The default cabling is described at the beginning of the programming script:
# Script setup. Use this as a documentation to cable the Crazyradio or modify
# if you want to cable it differently.
# Name Pin on raspi Pin on Crazyradio
#-------------------------------------------
GND = 6 # 9
RESET = 3 # 3
PROG = 5 # 2
SCK = 7 # 4
MOSI = 8 # 6
MISO = 10 # 8
CS = 12 # 10
The pin number on both the Crazyradio and the Raspberry Pi correspond to the physical number on the connector.
The Crazyradio should be powered, either using the expansion port VDD pin (1) or by connecting it to a USB port. When using the Raspberry Pi connector the setup looks like that:
Running the script
The script is located in the Crazyradio github repos in the fix_bootloader folder. You will need to clone this repos in your Raspberry Pi and run the script.
For more detail: Fixing Crazyradio USB Bootloader with a Raspberry pi