简体   繁体   English

DFU模式下的STM32F04仅在电池供电时识别(Win10)

[英]STM32F04 in DFU mode recognized only when powered from battery (Win10)

I made a STM32F042k6, battery powered device, that I would to flash vi DFU protocol.我制作了一个 STM32F042k6,电池供电的设备,我想刷 vi DFU 协议。

In order to do so I disconnect the battery, I pull BOOT0 to VCC, and then plug the device in USB3 port of PC (no USB2 available).为此,我断开电池,将 BOOT0 拉到 VCC,然后将设备插入 PC 的 USB3 端口(没有可用的 USB2)。 The device is not recognized and showed VID:0000 PID:0002 (case I)设备无法识别并显示 VID:0000 PID:0002(案例一)

However, when I first connect battery, and then connect the device to PC it is recognized without a fuss (case II).但是,当我第一次连接电池,然后将设备连接到 PC 时,它会毫不费力地被识别(案例 II)。

The problem I face is that I would like to initiate jump to bootloader program by command in software - but then I reach exactly the same condition as in case I.我面临的问题是我想通过软件中的命令开始跳转到引导加载程序 - 但后来我达到了与我完全相同的条件。

Could you help me to identify what conditions for proper boot I am violating?你能帮我确定我违反了正确启动的条件吗?

EDIT: The way I have discovered the problem was when I implemented software jump to bootloader.编辑:我发现问题的方式是当我实现软件跳转到引导加载程序时。 It seemed not to work at all (VCP device dissapeared, and erroreous <> device appeard in system PID:0002 VID:0000).它似乎根本不起作用(VCP 设备消失,并且错误的 <> 设备出现在系统 PID:0002 VID:0000 中)。 I wanted to enter bootloader by pulling up BOOT0 pin, but I could see that I sucseed only when battery-power cycled.我想通过拉起 BOOT0 引脚来进入引导加载程序,但我可以看到我只有在电池电源循环时才成功。 USB power cyccle resulted in the same "failed descriptor" device. USB 电源循环导致相同的“失败的描述符”设备。

I suspect that when powered on via USB, the booloader has som ecommunication problems and cannot establish proper PID and VID.我怀疑当通过 USB 开机时,booloader 存在一些通信问题,无法建立正确的 PID 和 VID。 When powered via battery - this problem is not existing.通过电池供电时 - 不存在此问题。

Do you have a discovery board? 您有探索板吗?

I read in the STM32F042x4/x6 Reference Manual (DocID025832 Rev 5): 我阅读了STM32F042x4 / x6参考手册(DocID025832 Rev 5):

The STM32F042x4/x6 embeds a full-speed USB device peripheral compliant with the USB specification version 2.0. STM32F042x4 / x6嵌入了一个符合USB规范版本2.0的全速USB设备外设。

(part 3.19, p.27). (第3.19部分,第27页)。

In the AN2606 (Rev 33), a table shows the USB configuration which is used by the DFU Bottolader in USB FS (Full-speed): 在AN2606(Rev 33)中,有一张表显示了DFU Bottolader在USB FS(全速)中使用的USB配置:

在此处输入图片说明

I assume that the USB in the bootloader is the 2.0, but USB 3.0 must be USB 2.0 compliant. 我假设引导加载程序中的USB是2.0,但是USB 3.0必须符合USB 2.0。 So it is possible to use an USB 3.0 port. 因此可以使用USB 3.0端口。

I suggest you use the DfUSe Demo from ST. 我建议您使用ST的DfUSe演示 Its interface consists of a tab where the DFU devices available are displayed when detected. 它的界面包括一个标签,在其中检测到可用的DFU设备。 I try it on another STM32x by following these steps: 我按照以下步骤在另一个STM32x上尝试:

  • Open DfuSe Demo software. 打开DfuSe Demo软件。
  • Plug BOOT0 to Vdd to put the micro on DFU mode. 将BOOT0插入Vdd以使微控制器进入DFU模式。
  • Plug the USER USB to your computer port. 将USER USB插入计算机端口。
  • The name of your device should appear in “Available DFU Devices” field. 设备的名称应显示在“可用的DFU设备”字段中。

You could try to use directly PA11 and PA12 as well (according to Table 12 ) instead of the USB port of your board. 您也可以尝试直接使用PA11和PA12(根据表12 ),而不是使用主板的USB端口。

EDIT: 编辑:
Another solution to upgrade your firmware without driving boot0 is to jump directly into the DFU bootloader of ST inside your firmware. 无需驱动boot0即可升级固件的另一种解决方案是直接跳入固件内部ST的DFU引导加载程序。 Else you could design your own IAP bootloader (In-Application Programming). 否则,您可以设计自己的IAP引导加载程序(应用程序内编程)。

I hope that helps. 希望对您有所帮助。

I faced this same issue with the STM32 Mini F401 and dug into it for several days.在 STM32 Mini F401上遇到了同样的问题,并研究了几天。 Unlike the OP I was unable to find any electrical conditions which reliably got the bootloader to do the right thing.与 OP 不同,我无法找到任何能够可靠地让引导加载程序执行正确操作的电气条件。 I was able to program my board maybe once every 20 tries, which was really slowing down my process.我可以每 20 次尝试对我的电路板进行一次编程,这确实减慢了我的进程。

In the end I discovered that I can go to the Windows device manager, show hidden devices, and there will be an entry in Universal Serial Bus Devices called STM32 BOOTLOADER .最后发现可以进入Windows设备管理器,显示隐藏设备,Universal Serial Bus Devices里面会有一个入口,叫做STM32 BOOTLOADER When the issue is happening the board is connected in dfu mode but that device is not marked active in the device manager.当问题发生时,板以 dfu 模式连接,但该设备未在设备管理器中标记为活动。

To resolve the issue consistently, you can manually delete the hidden STM32 BOOTLOADER entry, uninstalling the device (no need to delete the driver, just uninstall the device).为了一致地解决问题,您可以手动删除隐藏的STM32 BOOTLOADER条目,卸载设备(无需删除驱动程序,只需卸载设备即可)。 Then reboot your board in DFU mode and it should connect as expected every time.然后在 DFU 模式下重新启动您的主板,它应该每次都按预期连接。 Unfortunately I need to do this process every time I want to program, but that's far better than the inconsistent/intermittent failures before.不幸的是,我每次想要编程时都需要执行此过程,但这比之前的不一致/间歇性故障要好得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM