简体   繁体   English

STM32 bluepill USB 引导加载程序 DFU

[英]STM32 bluepill USB bootloader DFU

I am trying to make a base project for blue pill STM32F103 which I can use for multiple projects.我正在尝试为蓝色药丸 STM32F103 制作一个基础项目,我可以将其用于多个项目。 I would like to be able to both flash the device and send commands using serial COM port using the mirco-USB port我希望能够使用 mirco-USB 端口刷新设备并使用串行 COM 端口发送命令

so far I have:到目前为止我有:

  • successfully created a "hello world" flashing LED makefile based project downloaded to device using STLINK tool使用 STLINK 工具成功创建了一个基于“hello world”闪烁 LED 生成文件的项目下载到设备
  • created UART command interface to command through serial FTDI device创建 UART 命令接口以通过串行 FTDI 设备进行命令
  • flashed a DFU bootloader onto the chip and successfully used it to flash my own (makefile compiled) bin onto the device将 DFU 引导加载程序闪存到芯片上并成功使用它将我自己的(编译的)bin 闪存到设备上

when using the DFU I find that once I have flashed my .bin onto the device it no longer appears as a USB device.使用 DFU 时,我发现将 .bin 刷入设备后,它不再显示为 USB 设备。 following the article linked below I shouldn't need to modify the ROM address of my projects code, I have shortened file size to 55k in my makefile projects linker with still no success按照下面链接的文章,我不需要修改我的项目代码的 ROM 地址,我在我的 makefile 项目链接器中将文件大小缩短到 55k,但仍然没有成功

https://os.mbed.com/users/devanlai/code/STM32F103C8T6_USBDFU/graph/ https://github.com/devanlai/dapboot/releases/tag/v0.1 https://os.mbed.com/users/devanlai/code/STM32F103C8T6_USBDFU/graph/ https://github.com/devanlai/dapboot/releases/tag/v0.1

my questions:我的问题:

  • when using the DFU bootloader, once my code is running how is it supposed to become visible as a USB device if the usb stack is not written in in my application code?使用 DFU 引导加载程序时,一旦我的代码运行,如果我的应用程序代码中没有写入 USB 堆栈,它应该如何作为 USB 设备可见?
  • Do i need to move the jumpers on the bluepill?我需要移动 bluepill 上的跳线吗? I have tried various combinations already with no success我已经尝试了各种组合但没有成功
  • what is the best way for me to get a serial comms AND bootloader through USB in my project without writing and debugging my own unique bootloader?在我的项目中通过 USB 获得串行通信和引导加载程序而无需编写和调试我自己独特的引导加载程序的最佳方法是什么?

So if I understand your question correctly then you want to flash your MCU board with DFU over USB and to connect to an USB serial port while it is running.因此,如果我正确理解了您的问题,那么您希望通过 USB 使用 DFU 刷新您的 MCU 板,并在它运行时连接到 USB 串行端口。

This can be done as the DFU function is part of the bootloader and the USB serial port is part of your application.这可以完成,因为 DFU 功能是引导加载程序的一部分,而 USB 串行端口是您的应用程序的一部分。

The easiest way to create a virtual com port is using the STM32 CubeMX USB CDC.创建虚拟 COM 端口的最简单方法是使用 STM32 CubeMX USB CDC。 An video example is found here.可以在此处找到视频示例。 The source code generated by CubeMX can be pulled out and added into your own project. CubeMX生成的源代码可以拉出来添加到自己的项目中。

I afraid it will not appear anymore as the USB device, unless you implement the USB stack in your code.恐怕它不会再作为 USB 设备出现了,除非您在代码中实现了 USB 堆栈。

what is the best way for me to get a serial comms AND bootloader through USB in my project without writing and debugging my own unique bootloader?在我的项目中通过 USB 获得串行通信和引导加载程序而无需编写和调试我自己独特的引导加载程序的最佳方法是什么?

There is only one way - you need to have USB stack in your application.只有一种方法 - 您需要在应用程序中使用 USB 堆栈。

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

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