GD-Link 无法擦除 GD32 芯片问题排查与解决记录
GD-Link 无法擦除 GD32 芯片问题排查与解决记录
问题背景
在开发 GD32 项目时,使用 GD-Link 烧录工具对芯片进行编程,遇到了无法擦除 Flash 的问题。具体表现为:GD-Link Programmer 能够正常识别并连接芯片(Connected successfully!),且能读取 Option Bytes,但在执行擦除操作时始终报错。
问题现象
-
能够连接、读取 Option Bytes,但无法擦除
[14:03:21] Getting option successfully! [14:03:21] 6F AA 90 55 FF FF FF FF 00 73 FF 8C 55 FF AA FF [14:03:58] Removing read protection successfully! [14:03:58] Getting option successfully! [14:03:58] 6F AA 90 55 FF FF FF FF 00 73 FF 8C 55 FF AA FF [14:04:28] Error:Setting level low read protection failed! [14:04:30] Error:Removing read protection failed! [14:04:37] Error:Removing read protection failed! -
点击
Target -> Insecurity尝试解除读保护失败,提示Removing read protection failed!
原因分析
通过读取到的 Option Bytes 数据 6F AA 90 55 ... 判断:
- 关键字节
AA和55表明芯片处于读保护(Read Protection)状态 - 正常未保护状态的 Option Bytes 应为
A5 5A - 芯片在读保护状态下,调试接口的 Flash 擦除和写入操作会被硬件拦截
- 常规的
Insecurity命令本次未能成功解除保护,推测是 Option Bytes 配置出现了异常/混乱,导致软件解锁指令无法正确执行
解决方案
核心操作:通过 Configure Option Bytes 手动复位 Option Bytes 配置

- 在 GD-Link Programmer 软件中,点击菜单栏
Target->Configure Option Bytes - 在弹出的 Option Bytes 配置窗口中,点击
Reset OB按钮(将 Option Bytes 恢复为默认值) - 点击
Apply OB按钮,将复位后的 Option Bytes 写入芯片 - 此时 Option Bytes 被强制重置为有效状态,读保护标志被清除
- 再次执行
Target->Mass Erase,全片擦除成功

成功日志
[14:14:35] Getting option successfully!
[14:14:35] EF AA 10 55 FF FF FF FF FF 7F 00 80 FF FF 00 FF ← Option Bytes 已被重置
[14:14:40] Removing read protection successfully! ← 解除保护成功
[14:14:40] Getting option successfully!
[14:14:40] EF AA 10 55 FF FF FF FF FF 7F 00 80 FF FF 00 FF
[14:15:07] DisConnected successfully!
[14:15:08] Connected successfully!
[14:15:08] Getting option successfully!
[14:15:08] EF AA 10 55 FF FF FF FF FF 7F 00 80 FF FF 00 FF
[14:15:11] Reset CPU successfully!
[14:15:12] Starting programming:
[14:15:12] Erasing....
[14:15:12] -----Erasing complete! ← 擦除成功
[14:15:12] -----Erasing time: 0.640 s
[14:15:12] Reset MCU....
[14:15:12] -----Reset MCU complete!
[14:15:12] Downloading data....
[14:15:13] -----Programming time: 0.921 s
[14:15:13] -----Programming speed: 59.51 KB/s
[14:15:13] -----Download data complete!
[14:15:13] Programming and Verification Successfully! ← 烧录验证成功
[14:17:50] Getting option successfully!
[14:17:50] EF AA 10 55 FF FF FF FF FF 7F 00 80 FF FF 00 FF
关键要点总结
| 操作 | 作用 |
|---|---|
Target -> Configure Option Bytes |
进入 Option Bytes 配置界面 |
点击 Reset OB |
将 Option Bytes 恢复为芯片出厂默认值 |
点击 Apply OB |
将配置写入芯片,生效 |
再执行 Mass Erase |
此时芯片已解除保护,可正常擦除 |
注意事项
- 读保护(Read Protection)是导致擦除失败的最常见原因,当芯片能识别但无法擦除/烧录时,优先排查 Option Bytes 状态
- 常规
Insecurity命令不一定总能生效,当它失效时,通过Configure Option Bytes->Reset OB->Apply OB的方式强制复位 Option Bytes 是一种有效的备选方案 - 建议在开发调试阶段,谨慎启用读保护功能,或确认保护级别为 Low 级别以便后续解除
相关工具与环境
- 调试器:GD-Link
- 烧录软件:GDLinkUtilityProgrammer.exe
- 目标芯片:GD32F527(系列)
- 操作环境:Windows11
浙公网安备 33010602011771号