Create Crazyflie Firmware/Crazyflie Bootloader authored by Colton Glick's avatar Colton Glick
## Crazyflie Bootloader Recovery
It is possible for the crazyflie bootloader to get overwritten or corrupted. Some symptoms that indicated this is the case include:
- When powering on the crazyflie, only the M2 led is lit and stays solid
- The power button does not power off the crazyflie
- When putting the Crazyflie into bootloader mode by holding down the power button, only the M2 led flashes slowly
- If the power button does not work, must unplug the battery, hold the power button, and plug the battery back in while holding the power button
To fix this, the bootloader and firmware must be reflashed to the crazyflie. To flash the bootloader do the following:
1. Clone the [Bitcraze Crazyflie Bootloader repository](https://github.com/bitcraze/crazyflie2-stm-bootloader)
2. Build the bootloader by running `make` from within `crazyflie2-stm-bootloader/`. This should generate the cf2loader.bin file.
3. Put the Crazyflie into DFU mode
1. Disconnect the battery
2. Hold the power button down
3. Connect the Crazyflie to your machine via USB
4. Continue holding the power button (about 5 seconds) until the blue light reaches its second speed of flashing (about 1hz). The crazyflie's microprocessor (STM32F405) is now in DFU mode.
4. Overwrite the existing bootloader by running `dfu-util -d 0483:df11 -a 0 -s 0x08000000 -D cf2loader.bin`. Notice this command downloads cf2loader.bin to address `0x08000000`, this is the start of the crazyflie memory.
5. Once finished downloading the bootloader to the crazyflie, disconnect USB.
6. At this point, putting the Crazyflie into bootloader mode should show both M2 and M3 LEDs flashing.
7. Flash the Crazyflie firmware as normal, see [Flashing](Crazyflie-Firmware/Flashing)
\ No newline at end of file