打印
[STM32F1]

STM32单片机只能下载一次程序的问题

[复制链接]
1132|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
10299823|  楼主 | 2023-12-30 23:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

使用了ST公司的STM32单片机,遇到了奇怪的现象:每个单片机只能下载一次程序,之后的每次操作都会出现Flash写入错误,更换4,5次单片机也是如此,如下图。

窗口中的打印信息为

JLink info:
------------
DLL: V4.40c, compiled Jan 24 2012 09:30:33
Firmware: J-Link ARM V8 compiled Dec 6 2011 18:57:44
Hardware: V8.00
S/N : 20100214
Feature(s) : RDI,FlashDL,FlashBP,JFlash,GDBFull

* JLink Info: Found SWD-DP with ID 0x1BA01477
* JLink Info: TPIU fitted.
* JLink Info: FPUnit: 6 code (BP) slots and 2 literal slots
* JLink Info: Found Cortex-M3 r1p1, Little endian.
ROMTableAddr = 0xE00FF003
* JLink Info: Found SWD-DP with ID 0x1BA01477
* JLink Info: TPIU fitted.
* JLink Info: FPUnit: 6 code (BP) slots and 2 literal slots
* JLink Info: Found Cortex-M3 r1p1, Little endian.

Target info:
------------
Device: STM32F103T8
VTarget = 3.028V
State of Pins:
TCK: 0, TDI: 0, TDO: 0, TMS: 0, TRES: 1, TRST: 1
Hardware-Breakpoints: 6
Software-Breakpoints: 8192
Watchpoints: 4
JTAG speed: 2000 kHz

Erase Done.
Programming Failed!

笔者使用的下载方式是SWD,从打印信息中可以看到,JLink成功地擦除了单片机的Flash,但写入失败。然而,在这款产品的第一版中,并没有出现这样的问题。较大的区别是,第一版所用型号为STM32F103C8T6,第二版为了缩小尺寸选用了STM32F103T8U6。查看Datasheet,认为这里两款芯片除了封装尺寸,IO数目不同以外,在配置上并没有什么差异。

尝试诊断问题,发现Flash下载配置选项似乎不正常,如下图:

根据已有的产品开发经验,如果Flash擦除不完整,很容易出现问题。于是勾选“Erase Full Chip”选项,如下图。

再次下载程序,终于成功了,窗口中出现了正确的打印信息

JLink info:
------------
DLL: V4.40c, compiled Jan 24 2012 09:30:33
Firmware: J-Link ARM V8 compiled Dec 6 2011 18:57:44
Hardware: V8.00
S/N : 20100214
Feature(s) : RDI,FlashDL,FlashBP,JFlash,GDBFull

* JLink Info: Found SWD-DP with ID 0x1BA01477
* JLink Info: TPIU fitted.
* JLink Info: FPUnit: 6 code (BP) slots and 2 literal slots
* JLink Info: Found Cortex-M3 r1p1, Little endian.
ROMTableAddr = 0xE00FF003
* JLink Info: Found SWD-DP with ID 0x1BA01477
* JLink Info: TPIU fitted.
* JLink Info: FPUnit: 6 code (BP) slots and 2 literal slots
* JLink Info: Found Cortex-M3 r1p1, Little endian.

Target info:
------------
Device: STM32F103T8
VTarget = 3.028V
State of Pins:
TCK: 0, TDI: 0, TDO: 0, TMS: 0, TRES: 1, TRST: 1
Hardware-Breakpoints: 6
Software-Breakpoints: 8192
Watchpoints: 4
JTAG speed: 2000 kHz

Full Chip Erase Done.
Programming Done.
Verify OK.


使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

29

主题

3291

帖子

1

粉丝