@@ -4,10 +4,22 @@ To automatically set a specific crazyflie into boot loader mode, add `CLOAD_CMDS
...
@@ -4,10 +4,22 @@ To automatically set a specific crazyflie into boot loader mode, add `CLOAD_CMDS
1. Compile the firmware, see [How to Build](Crazyflie-Firmware/How-to-Build)
1. Compile the firmware, see [How to Build](Crazyflie-Firmware/How-to-Build)
2. Run `make cload`. Your machine should connect to the crazyflie on the specified radio channel, set it to bootloader mode, and begin flashing the newly built firmware.
2. Run `make cload`. Your machine should connect to the crazyflie on the specified radio channel, set it to bootloader mode, and begin flashing the newly built firmware.
# Device Firmware Update (DFU) Mode (Flashing Over USB)
# Flashing over USB (Device Firmware Update (DFU) Mode)
This mode allows for flashing the Crazyflie firmware over USB. More specifically it will overwrite the firmware on the microcontroller (STM32F405) that runs the Crazyflie. Writing using usb provides some advantages over using the crazyradio, mainly it does not require modifying the `config.mk` file and many Crazyflies can be flashed near by with no conflicts
0. Ensure `dfu-util` is installed on your machine
1. Compile the firmware, see [How to Build](Crazyflie-Firmware/How-to-Build)
2. Disconnect the battery
3. Hold the power button down
4. Plug the USB cable into your machine
5. Continue holding the power button until the blue light reaches its second level of flashing (about 5 seconds). The crazyflie's microprocessor (STM32F405) is now in DFU mode.
6. Execute `make flash_dfu` to begin flashing, do not remove usb cable until flashing is complete and the Crazyflie reboots
## Manual DFU update
### **WARNING, THIS METHOD CAN OVERWRITE THE BOOTLOADER, USE WITH CAUTION**
### **WARNING, THIS METHOD CAN OVERWRITE THE BOOTLOADER, USE WITH CAUTION**
This method is meant as a last resort recovery mode for the crazyflie, however it allows for flashing over a USB connection. This gives some advantages over using the crazyradio, mainly it does not require modifying the `config.mk` file and many crazyflies can be flashed near by with no conflicts
This method is what happens behind the scenes when running `make flash_dfu`. This can manually overwrite the Crazyflie firmware and the bootloader so use with caution.
0. Ensure `dfu-util` is installed on your machine
1. Disconnect the battery
1. Disconnect the battery
2. Hold the power button down
2. Hold the power button down
3. Plug the USB cable into your machine
3. Plug the USB cable into your machine
...
@@ -15,7 +27,7 @@ This method is meant as a last resort recovery mode for the crazyflie, however i
...
@@ -15,7 +27,7 @@ This method is meant as a last resort recovery mode for the crazyflie, however i
5. Check the USB device is in DFU mode. On linux run `lsusb`. The crazyflie should show up as `Bus xxx Device xxx: ID 0483:df11 STMicroelectronics STM Device in DFU Mode`
5. Check the USB device is in DFU mode. On linux run `lsusb`. The crazyflie should show up as `Bus xxx Device xxx: ID 0483:df11 STMicroelectronics STM Device in DFU Mode`
6. Flash the firmware.
6. Flash the firmware.
-**Recommended** Using cf2.dfu file
-**Recommended** Using cf2.dfu file
- After compiling the firmware we can use the generated `cf2.dfu` file to flash by using the following command `sudo dfu-util -d 0483:df11 -a 0 -D cf2.dfu`
- After compiling the firmware we can use the generated `cf2.dfu` file to flash by using the following command `sudo dfu-util -d 0483:df11 -a 0 -D cf2.dfu -R`
- Using cf2.bin file
- Using cf2.bin file
- This method requires we specify the address to write the new firmware to.
- This method requires we specify the address to write the new firmware to.
- If the firmware was built with `CLOAD=1` (the default configuration) the firmware needs to be flashed to address `0x08004000` with the command `sudo dfu-util -d 0483:df11 -a 0 -s 0x08004000 -D cf2.bin`
- If the firmware was built with `CLOAD=1` (the default configuration) the firmware needs to be flashed to address `0x08004000` with the command `sudo dfu-util -d 0483:df11 -a 0 -s 0x08004000 -D cf2.bin`
...
@@ -58,6 +70,11 @@ Download done.
...
@@ -58,6 +70,11 @@ Download done.
done parsing DfuSe file
done parsing DfuSe file
```
```
## Help! I overwrote the bootloader!
TODO: instructions on how to reflash the bootloader. Build firmware with flag CLOAD=0 flash it to address `0x08000000`
`sudo dfu-util -d 0483:df11 -a 0 -s 0x08000000 -D cflie.bin`