参考https://wiki.bitcraze.io/projects:crazyflie2:development:dfu
DFU更新模式主要被考虑作为一种恢复模式,它可以下载新的固件到STM32F405中;另外空中下载OTA(Over The Air)也可以更新固件,相对DFU更方便一些,用这种方法我们也可以更新nRF51822。
使用apt-get安装dfu-util
apt-get install dfu-util
然后我们就可以使用DFU更新模式引导STM32F405
1. 连接一个micro-USB线到你的电脑,但是先不要连接到Crazyflie 2.0; 2. 断开Crazyflie 2.0供电电池(如果电池已经连接上); 3. 按下button(on/off),保持按下状态,然后插入USB线到Crazyflie 2.0; 4. 按下状态保持五秒,当你看到第二个等闪烁(频率1HZ)的时候,就可以松开按键了; 5. 这个时候STM32F405就处于DFU模式了。
为了确保DFU模式是正常的,我们可以通过lsusb看到如下信息:
lsusb
...
Bus XXX Device XXX: ID 0483:df11 STMicroelectronics STM Device in DFU Mode
...
sudo dfu-util -d 0483:df11 -a 0 -s 0x08004000 -D cflie.bin
sudo dfu-util -d 0483:df11 -a 0 -s 0x08000000 -D cflie.bin
cf@bitcraze:~/projects/crazyflie-firmware$ sudo dfu-util -a 0 -s 0x08004000 -D cflie.bin
dfu-util 0.5
(C) 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
(C) 2010-2011 Tormod Volden (DfuSe support)
This program is Free Software and has ABSOLUTELY NO WARRANTY
dfu-util does currently only support DFU version 1.0
Opening DFU USB device... ID 0483:df11
Run-time device DFU version 011a
Found DFU: [0483:df11] devnum=0, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/04*016Kg,01*064Kg,07*128Kg"
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
No valid DFU suffix signature
Warning: File has no DFU suffix
DfuSe interface name: "Internal Flash "