无法使用 ST Link 实用程序对 STM32 进行编程:编程错误 @: 0x00000001

Unable to program STM32 using ST Link utility: programming error @: 0x00000001

我一直在努力掌握 STM32 编程。我有一个 Nornir 开发的 Dash7/sensor 板(绝对没有任何文档存在......),它有一个 STM32L100RBT6 MCU。所以我想为这个板子编写我自己的软件。

至此,我已经成功地制作了一个项目并构建了固件。此时,我正在尝试使用官方 ST-link v2 编程器结合 ST-Link 实用软件(在 windows 10 下)将 .hex 文件闪存到 MCU 上.我用的是板子上的JTAG接口

在 ST-link 实用程序中,我可以连接到开发板并读取它。我已经擦除芯片,并且我只在内存中读取两个内存页(0x00000000 和 0x08000000)的零。

然而,当我尝试 Target > Program 时,在 select 打开我的 .hex 文件并点击“开始”后,控制台告诉我:

16:54:48 : Connected via JTAG.
16:54:48 : Connection mode : Normal.
16:54:48 : Debug in Low Power mode enabled.
16:54:49 : Device ID:0x416 
16:54:49 : Device flash Size : 128KBytes
16:54:49 : Device family :STM32L100x8/L15xx8
16:54:52 : Memory programmed in 0s and 250ms.

但是当我读出内存时,它没有被编程。它只在两个页面上显示零(0x00000000 和 0x08000000)。

当我 select Target > Program & Verify 时,我收到一条错误消息 'programming error @: 0x00000001' 和以下控制台输出:

16:55:39 : Connected via JTAG.
16:55:39 : Connection mode : Normal.
16:55:39 : Debug in Low Power mode enabled.
16:55:39 : Device ID:0x416 
16:55:39 : Device flash Size : 128KBytes
16:55:39 : Device family :STM32L100x8/L15xx8
16:56:16 : No OnChip verification function found. Verify after programming will be performed.
16:56:17 : Programming error @: 0x00000001

我记忆中的linker脚本(mem.ld)如下:

MEMORY
{
  FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
  RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 10K

  /*
   * Optional sections; define the origin and length to match
   * the the specific requirements of your hardware. The zero
   * length prevents inadvertent allocation.
   */
  CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0
  FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
  EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
}

我被困在这一点上,到目前为止还找不到任何资源指向正确的方向。有什么想法吗?

ST Link 实用程序缓存您使用的文件。它没有在任何地方记录,但它这样做了。如果你想 100% 确定你已经编程了最新的 binary/hex 文件更改文件的名称(从以前的版本)并再次编程