Skip to main content
fancyrat
Associate II
February 8, 2023
Solved

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

  • February 8, 2023
  • 9 replies
  • 6810 views

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!

This topic has been closed for replies.
Best answer by MM..1

Your pin list omit GND i hope connected

and read How to unlock STM32G031J6M6 (STM32G0316-DISCO)?

9 replies

Javier1
Principal
February 8, 2023
  • which specific STM32G031 is?

Im using stm32g030j6Mx without selecting SW pins and i dont have this issue

  •  Which cubeProgr version are you using?

  • Did you do the STlink configuration Mode raindance?

0693W00000YAFdEQAX.pngCheck all posibilities.

hit me up in https://www.linkedin.com/in/javiermuñoz/
fancyrat
fancyratAuthor
Associate II
February 8, 2023

Hi Javier,

I'm using STM32G031J6M6 & CubeProgrammer v2.11.0.

I've tried right now other modes. Normal is the one of my post, hotplug has the same errors but the current doesn't change, under reset same errors & also current drop to almost 0, finally power down doesn't react at all "No STM32 target found!" at all times.

This is the ST-LINK configuration I've been using until now:

0693W00000YAFl8QAH.png

MM..1
Chief III
February 8, 2023

Disconect power from your board

connect stlink start in power down mode

click connect

plug power to board

fancyrat
fancyratAuthor
Associate II
February 8, 2023

Can you please expand on that? If I tri to connect with the board disconnected from power and then I try to "connect" with ST-LINK in power down mode I just get the message "No STM32 target found!"

MM..1
MM..1Best answer
Chief III
February 8, 2023

Your pin list omit GND i hope connected

and read How to unlock STM32G031J6M6 (STM32G0316-DISCO)?

KnarfB
Super User
February 8, 2023

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

looks like your ST-LINK may need a firmware update?

hth

KnarfB

fancyrat
fancyratAuthor
Associate II
February 8, 2023

I updated the ST-LINK but same problem:

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

KnarfB
Super User
February 8, 2023

on my STM32G0316-DISCO:

15:07:11 : ST-LINK SN : 0669FF3536324D5043013913
 15:07:11 : ST-LINK FW : V2J39M27
 15:07:11 : Board : NUCLEO-G031J6
 15:07:11 : Voltage : 3.23V
 15:07:11 : SWD freq : 4000 KHz
 15:07:11 : Connect mode: Normal
 15:07:11 : Reset mode : Hardware reset
 15:07:11 : Device ID : 0x466
 15:07:11 : Revision ID : Rev 1.1
 15:07:11 : ST-LINK SN : 0669FF3536324D5043013913
 15:07:11 : ST-LINK FW : V2J39M27
 15:07:11 : Board : NUCLEO-G031J6
 15:07:11 : Voltage : 3.23V
 15:07:11 : SWD freq : 4000 KHz
 15:07:11 : Connect mode: Normal
 15:07:11 : Reset mode : Hardware reset
 15:07:11 : Device ID : 0x466
 15:07:11 : Revision ID : Rev 1.1
 15:07:11 : Debug in Low Power mode is not supported for this device.
 15:07:11 : UPLOADING OPTION BYTES DATA ...
 15:07:11 : Bank : 0x00
 15:07:11 : Address : 0x40022020
 15:07:11 : Size : 112 Bytes
 15:07:11 : UPLOADING ...
 15:07:11 : Size : 1024 Bytes
 15:07:11 : Address : 0x8000000
 15:07:11 : Read progress:
 15:07:11 : Data read successfully
 15:07:11 : Time elapsed during the read operation is: 00:00:00.006

have a different firmware version, why?

Device..ID are same, so what *is* the difference?

Different voltages?

Try lowering the SWD Speed significantly.

still: "Error: Database" makes me nervous.

hth

KnarfB

BenMack99
Associate III
February 17, 2023

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

MM..1
Chief III
February 17, 2023

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

BenMack99
Associate III
February 17, 2023

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 III
February 17, 2023

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
Associate III
February 17, 2023

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
Associate III
February 17, 2023

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