cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to flash STM32G031 (8 pins) with STM32CubeProgrammer & ST-LINK/V2.

fancyrat
Associate III

I've have a custom board with a STM32G031,from the board we have access to the following MCU pins:

  • +3V3_BT
  • NRSTBT
  • SWDIO
  • SWCLK_USARTTX

I've connected this 4 pins to a ST-LINK/V2. Like this (left) mcu, (right) st-link.

  • +3V3_BT --> VCC
  • NRSTBT --> NRST
  • SWDIO --> SWDIO
  • SWCLK_USARTTX --> SWCLK

The current delivered by PSU goes to almost 0 after trying to flash (around 0.004A from the correct 0.041A). When trying to flash the uC these are the errors/log I get:

10:37:32 : ST-LINK SN  : 55FF6E067871515343241267
10:37:32 : ST-LINK FW  : V2J39S7
10:37:32 : Board       : --
10:37:32 : Voltage     : 2,60V
10:37:32 : SWD freq    : 4000 KHz
10:37:32 : Connect mode: Normal
10:37:32 : Reset mode  : Software reset
10:37:32 : Device ID   : 0x466
10:37:32 : Revision ID : Rev 1.1
10:37:35 : Error: Database: There's no active configuration for this device. All the 6 configurations are disabled!
10:37:35 : Debug in Low Power mode is not supported for this device.
10:37:36 : UPLOADING OPTION BYTES DATA ...
10:37:36 :   Bank          : 0x00
10:37:36 :   Address       : 0x40022020
10:37:36 :   Size          : 108 Bytes
10:37:36 : Error: Uploading Option Bytes bank: 0 failed
10:37:38 : Error: Initializing the Option Bytes failed
10:37:38 : Disconnected from device.

Isolating the errors:

Error: Database: There's no active configuration for this device. All the 6 configurations are disabled!
Error: Uploading Option Bytes bank: 0 failed
Error: Initializing the Option Bytes failed

Any ideas on how to solve this?

Thanks!

15 REPLIES 15
BenMack99
Senior

I'm getting a very similar problem, new board design with STM32G031G4. Any suggestions welcome!

Using STM32CubeProgrammer and STLink, when I connect I get

Error: Database: There's no active configuration for this device. All the 6 configurations are disabled!

and when I program flash I get

File segment @0x08000000 is not 255-bytes aligned. It will be aligned to @0x07FFFFF8

If I connect to a NUCLEO-G031K8 instead, it connects and programs just fine, so I'm assuming these errors are due to a problem on the target board, not anything at the PC end. I also tried STM32CubeIDE, same errors. But if I use the old STM32 ST-Link Utility it can program the target just fine. And STM32CubeProgrammer can then verify the target (compare with file), but still cannot program it. So I guess the STM32Cube* apps are doing things differently to the old stlink utility.

Had a good look at signals with a scope, all looks clean, ground and 3V3 clean. Very simple board, standard SWD connections, I've done lots of similar designs with no problems. Tried running ST-Link at minimum speed, same. What seems strange is it connects, and reads Device ID  : 0x466 Revision ID : Rev Y, so SWD basics are working.

Here's the log from an attempted connect and program

  08:20:14 : ST-LINK SN  : 53FF6C067287555144431867
  08:20:14 : ST-LINK FW  : V2J40S7
  08:20:14 : Board       : --
  08:20:14 : Voltage     : 3.23V
  08:20:14 : SWD freq    : 100 KHz
  08:20:14 : Connect mode: Normal
  08:20:14 : Reset mode  : Hardware reset
  08:20:14 : Device ID   : 0x466
  08:20:14 : Revision ID : Rev Y
  08:20:14 : Error: Database: There's no active configuration for this device. All the 6 configurations are disabled!
  08:20:14 : UPLOADING OPTION BYTES DATA ...
  08:20:14 :   Bank          : 0x00
  08:20:14 :   Address       : 0x40022020
  08:20:14 :   Size          : 108 Bytes
  08:20:14 :   Bank          : 0x01
  08:20:14 :   Address       : 0x40022080
  08:20:14 :   Size          : 4 Bytes
  08:20:14 : UPLOADING ...
  08:20:14 :   Size          : 1024 Bytes
  08:20:14 :   Address       : 0x8000000
  08:20:14 : Read progress:
  08:20:15 : Data read successfully
  08:20:15 : Time elapsed during the read operation is: 00:00:00.660
  08:20:54 : Memory Programming ...
  08:20:54 : Opening and parsing file: wf3826.elf
  08:20:54 :   File          : wf3826.elf
  08:20:54 :   Size          : 3.45 KB 
  08:20:54 :   Address       : 0x08000000 
  08:20:54 : Erasing memory corresponding to segment 0:
  08:20:54 : Erasing external memory sectors [0 1]
  08:20:55 : File segment @0x08000000 is not 255-bytes aligned. It will be aligned to @0x07FFFFF8
  08:20:55 : Download in Progress:
  08:20:55 : Error: failed to download Segment[0]
  08:20:55 : Error: failed to download the File

Any suggestions? Thanks

Seems your elf linking script error or buggy stmprogrammer sw. Try flash bin file...

BenMack99
Senior

I've tried a bin file, same error (File segment @0x08000000 is not 255-bytes aligned. It will be aligned to @0x07FFFFF8). And it works fine if I connect to nucleo board instead of target. And that wouldn't explain the "Error: Database: There's no active configuration for this device" error when I connect.

So I'm thinking something else is going wrong and the PC apps are throwing spurious errors.

MM..1
Chief II

K8 and G4 is different id , but yes maybe other trouble on your board, check vcap power usw...

Somtimes reported errors from prog is long way from real...

STM32G031 programming with ST-Link and CubeIDE failed

BenMack99
Senior

I've been looking at the Revision ID, STM32Prog reports Rev Y for my board (and Rev 1.1 for NUCLEO). Looking at the reference manual (RM0444 Rev 5) page 1374 Table 254. REV_ID field values, it only lists A (1.0) and Z (1.1). So I'm guessing STM32Prog isn't recognising these Rev Y chips and so is doing silly things. Would explain the "Error: Database: There's no active configuration for this device"

Also, looking at Option Bytes in STM32Prog, it lists lots of duplicates, e.g. BOR_EN, BORF_LEV, BOR_LEV & NRST_MODE each repeated 4 times. Again I guess this could be a symptom of the above.

Why have I got Rev Y chips? And why are they not supported/listed? I guess this a question for ST

BenMack99
Senior

Just spotted, in Errata ES0487 Rev 5, they added silicon revision Y in May 2022.

Why is it not supported? I'm running latest STM32CubeProgrammer V2.12.0