当前位置:网站首页>STM32G0 USB DFU 升级校验出错-2
STM32G0 USB DFU 升级校验出错-2
2022-07-02 17:23:00 【gdut_llkkyy】
一、我遇到的问题
1.1 概述
需要用stm32g0 系列单片机实现固件升级功能,选择的升级方案是STM32 USB DFU 方案。由于我们需要做产品和固件匹配,还有一些其他功能,所以没有选择内置的boot,而是自己写boot,里面实现 usb dfu 功能。pc 客户端使用 st 官方提供的DfuSeDemo
。
1.2 遇到的问题
按照网上的流程,利用官方的cubemx 生产了boot 工程 ,配置了flash 的读写api,boot 就完成了。测试的时候发现,在某些电脑上升级固件时,随机出现校验出错。提示: matching not good . first difference at address ...
。 有些电脑出现得很频繁,有些电脑,出现的概率很低。
二、硬件连接
2.1 D+ D- 连接
2.2 pin 供电
USB USB-PD, USB-MD 连接的 IO 需要通过VDDIO2 供电,VDDIO2 需要提供一个1.6 ->3.6v的电压
2.3 VDDUSB IO
在AN2606 文档中,提到VDDUSB IO 必须接到3.3v,但是我没找到VDDUSB IO。
三、利用出厂boot 验证
boot 工程是根据官方的工具生成加轻微修改的,电路连接也比较简单,但是还是随机出错校验出错,会不会是这个单片机的usb 本身性能有问题呢?为了验证这款mcu 的usb 性能,我决定用官方的usb dfu boot 验证。
这里选择的pc 上位机是官网最新版的 STM32CubeProgrammer
,如果它都出问题,估计大概率是mcu 本身的问题了。
3.1 mcu 如何进入内置usb dfu boot ?
文档AN2606 提到 The STM32G0B1xx/0C1xx bootloader is activated by applying Pattern 11
, STM32G0B1 系列单片机,使用Pattern 11 进入内置 Boot模式。Pattern 11 定义如下:
如上图所示,Pattern11 也有几种方式,可以选择,我选择了第二个方式:先通过 STM32CubeProgrammer
将mcu 中的nBoot1(bit) 设置为1,nBOOT0_SEL(bit) 设置为0 ,然后将mcu 的 Boot0(pin) 接3.3v。上电重启,接入usb线,进入boot模式;
3.2 升级验证
以 STM32CubeProgrammer
为上位机,在不同pc 上升级验证了,都没出现校验出错。
3.3 本轮总结
内置boot 升级没异常,说明mcu 本身的usb 电路是没问题。还是要找自己的原因。原因可能是下面两个:
- 自己搭建的boot 有问题。
- 选择的升级客户端
DfuSeDemo
有问题。
四、小插曲,客户端无法识别
4.1 遇到的问题
安装使用了 STM32CubeProgrammer
之后,再使用DfuSeDemo
,发现DfuSeDemo
不能识别出设备( STM Device in DFU Mode
) 。
4.2 问题查找
打开我的电脑-> 设备管理器,发现在通用串行总线设备下面出现: STM32 Download Firmware Update
这个设备。
4.3 解决
右键点击 STM32 Download Firmware Update
, 选择卸载设备,并删除设备驱动程序。
将usb线拔出设备,然后再插入设备,DfuSeDemo
重新能识别出设备。
五、问题解决
检查了boot 工程的各个模块代码,都没发现异常。后面发现STM32G0 最新的驱动库是V1.5.1 ,而我用的是V1.5.0 。更新了最新的驱动库,问题解决了。比对了两个版本的代码,发现在stm32g0xx_ll_usb.c
这个文件作了大量的修改,这个刚好是usb的驱动函数库。暂时没时间,知识储备也不够,有机会再详细分析一下这个文件的差异。
边栏推荐
- Typical application of "stack" - expression evaluation (implemented in C language)
- 快速排序基本思路(通俗易懂+例子)「建议收藏」
- 300+ documents! This article explains the latest progress of multimodal learning based on transformer
- Rte11 interrupt decoupling function
- What are the links of the problem
- Introduction to sap s/4hana OData mock service
- Google's official response: we have not given up tensorflow and will develop side by side with Jax in the future
- Thoroughly understand the point cloud processing tutorial based on open3d!
- QQmlApplicationEngine
- Server PHP environment building tutorial, PHP server environment building graphic explanation
猜你喜欢
Stratégie touristique d'été de Singapour: un jour pour visiter l'île de San taosha à Singapour
Redis (6) -- object and data structure
Leetcode(81)——搜索旋转排序数组 II
Troubleshooting: kubectl reports an error validationerror: unknown field \u00a0
Web version 3D visualization tool, 97 things programmers should know, AI frontier paper | information daily # 2022.07.01
Excel如何进行隔行复制粘贴
300+ documents! This article explains the latest progress of multimodal learning based on transformer
揭秘得物客服IM全链路通信过程
呆错图床系统源码图片CDN加速与破J防盗链功能
How to clean up discarded PVs and their corresponding folders
随机推荐
M2dgr: slam data set of multi-source and multi scene ground robot (ICRA 2022)
Singapore summer tourism strategy: play Singapore Sentosa Island in one day
The difference between SLC, MLC, TLC and QLC NAND SSD: which is better?
Three ways of function parameter transfer in C language
exness深度好文:动性系列-黄金流动性实例分析(五)
【愚公系列】2022年07月 Go教学课程 001-Go语言前提简介
怎么用ps提取图片颜色分析色彩搭配
Websocket of Web real-time communication technology
Troubleshooting ideas that can solve 80% of faults
LightGroupButton* sender = static_cast<LightGroupButton*>(QObject::sender());
RTE11- 中断解耦功能
In early summer, Kaiyuan magic changed an electric mosquito racket with killing sound effect!
哪个券商公司网上开户佣金低又安全又可靠
C语言中函数参数传递的三种方式
鸿蒙第四次学习
Hongmeng's fourth learning
The student Tiktok publicized that his alma mater was roast about "reducing the seal of enrollment". Netizen: hahahahahahahaha
Eliminate the yellow alarm light on IBM p750 small computer [easy to understand]
第一次去曼谷旅游怎么玩?这份省钱攻略请收好
R语言dplyr包rowwise函数、mutate函数计算dataframe数据中多个数据列在每行的最大值、并生成行最大值对应的数据列(row maximum)