# DFU劫持

### 介绍

如果您的飞控板无法进入DFU模式

* 即使您120%保证已经安装了正确的驱动程序，以及使用了完好的计算机硬件（包括USB线缆），或者
* 即使您可以用您的计算机给其他飞控板刷写固件，或者
* 在某些特殊条件下，飞控板会间歇性地进入DFU模式

那么此页面将解释这些现象的原因，并为您提供解决方法。

### 什么是DFU劫持？

STM32系列MCU处于bootloader模式下时，会从多个不同的外设（包括USB VCP和UART）中寻找输入信号。如果有一个闲置设备连接到UART并发送了看起来像那么回事的有效信息，那么bootloader将专注于此UART端口，并尝试从UART端口加载固件。换句话说，闲置设备**劫持**了bootloader。

### 可能的解决方法

防止健谈的外设劫持DFU的变通方法如下：

1. 通过断开外设供电或在刷写时物理断开来关闭此外设。当仅连接USB时，使用USB供电无法触及的电源焊盘供外设使用是另一种替代方法。
2. 在重新上电之后，许多接收机只有在第一次对频（连接）到遥控器后才会发送有效的输出数据。在给此类接收机供电之前，请先关闭遥控器，以防止劫持。
3. 使用半双工协议，并使用TX引脚与外设相连。由于bootloader不会打开半双工模式，而是仅仅侦测RX引脚，因此在TX引脚上接受到的数据内容不会引起DFU劫持。
4. 避免将外设连接到bootloader对其敏感的UART端口上。F4上对bootloader相对敏感的UART端口是PA10、PB11和PC11。CLracingF4（JBF4）的UART1（PA10）和UART3（PB11）属于此类敏感端口。精心设计的飞控应当避免将bootloader敏感的UART端口设置为接收机默认端口。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pitronic.gitbook.io/betaflight/troubleshooting/dfu-hijacking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
