Skip to main content
elektronik_BP
Explorer
March 9, 2026
Solved

Unable to change NRST_MODE on stm32g031j6m6

  • March 9, 2026
  • 4 replies
  • 278 views

Hello,

I am working on using NRST pin in stm32g031j6m6 as GPIO, but it fails every time. I've changed many option bytes and even options present only on stm32g0x1 have workwd on my chip, except of NRST_MODE. If i want to change this option to 2 (gpio mode) and try to apply, the progress bar stays at 0% endlessly until i quit the STM32CubeProgrammer. I didn't have any problems with communication between nucleo and stm32g031. I tried to program my chip with st links built in nucleo u031 and f303, everytime without success. What else can i try? 

g031_014124.PNG

Best answer by Kouthair

Hello ​@crasbe  & ​@elektronik_BP ,
This issue has been fixed in STM32CubeProgrammer v2.23. You can download it via this link.

4 replies

TDK
March 9, 2026

Unable to duplicate here on STM32CubeProgrammer v2.21.0.

What version of STM32CubeProgrammer are you using? If not the latest, try that.

Screenshot 2026-03-09 140201.png

 

> I tried to program my chip with st links built in nucleo u031 and f303

Is this a separate issue? Please clarify.

If USB connections are flaky in general, it's probably a computer problem. Try eliminating hubs or using a different cable and port.

"If you feel a post has answered your question, please click ""Accept as Solution""."
ST Employee
March 10, 2026

Hello there @elektronik_BP ,

Thank you for bringing this to our attention.
I have reproduced this on v2.22 and I have reported this to the dedicated team. (internal ticket number:0060237)
For now, you can switch to v2.21 as it works there and I'll let you know ASAP when this is fixed.

PS: Ticket number: 0060237 is an internal tracking number and is not accessible or usable by customers.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Visitor II
June 19, 2026

Hello,

unfortunately there has been no new release of STM32CubeProgrammer yet, but it appears the issue is due to the naming of the Option Byte. In v2.21 it was called `NRST_MODE` and in v2.22 it is called `NRST_MODE (Present only on stm32g0x1 devices)`.

The STM32_Programmer_CLI program can not parse parameters with spaces though and neither does it accept quotes.
Unfortunately it also does not accept `NRST_MODE` anymore.
 

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd -ob NRST_MODE (Present only on stm32g0x1 devices)=3
-------------------------------------------------------------------
STM32CubeProgrammer v2.22.0
-------------------------------------------------------------------

ST-LINK SN :
ST-LINK FW : V2J47M34
Board : NUCLEO-G031K8
Voltage : 3.23V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x466
Revision ID : Rev 1.1
Device name : STM32G03x/STM32G04x
NVM size : 64 KBytes
Device type : MCU
Device CPU : Cortex-M0+
BL Version : 0x52

Error: Wrong command -ob: Unknown command or command missed some parameters, please refer to the help to see the supported commands.


C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd -ob "NRST_MODE (Present only on stm32g0x1 devices)"=3
-------------------------------------------------------------------
STM32CubeProgrammer v2.22.0
-------------------------------------------------------------------

ST-LINK SN :
ST-LINK FW : V2J47M34
Board : NUCLEO-G031K8
Voltage : 3.22V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x466
Revision ID : Rev 1.1
Device name : STM32G03x/STM32G04x
NVM size : 64 KBytes
Device type : MCU
Device CPU : Cortex-M0+
BL Version : 0x52

Error: Wrong command -ob: Unknown command or command missed some parameters, please refer to the help to see the supported commands.


C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd -ob NRST_MODE=3
-------------------------------------------------------------------
STM32CubeProgrammer v2.22.0
-------------------------------------------------------------------

ST-LINK SN :
ST-LINK FW : V2J47M34
Board : NUCLEO-G031K8
Voltage : 3.23V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x466
Revision ID : Rev 1.1
Device name : STM32G03x/STM32G04x
NVM size : 64 KBytes
Device type : MCU
Device CPU : Cortex-M0+
BL Version : 0x52


UPLOADING OPTION BYTES DATA ...

Bank : 0x00
Address : 0x40022020
Size : 108 Bytes

██████████████████████████████████████████████████ 100%

Bank : 0x01
Address : 0x40022080
Size : 4 Bytes

██████████████████████████████████████████████████ 100%


PROGRAMMING OPTION BYTES AREA ...
Warning: Option Byte: nrst_mode, does not exist

Warning: Option Bytes are unchanged, Data won't be downloaded
Time elapsed during option Bytes configuration: 00:00:00.007

 

With v2.21 it works just fine as described:

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin>STM32_Programmer_CLI.exe -c port=swd -ob NRST_MODE=3
-------------------------------------------------------------------
STM32CubeProgrammer v2.21.0
-------------------------------------------------------------------

ST-LINK SN :
ST-LINK FW : V2J47M34
Board : NUCLEO-G031K8
Voltage : 3.23V
SWD freq : 4000 KHz
Connect mode: Normal
Reset mode : Software reset
Device ID : 0x466
Revision ID : Rev 1.1
Device name : STM32G03x/STM32G04x
Flash size : 64 KBytes
Device type : MCU
Device CPU : Cortex-M0+
BL Version : 0x52


UPLOADING OPTION BYTES DATA ...

Bank : 0x00
Address : 0x40022020
Size : 108 Bytes

██████████████████████████████████████████████████ 100%

Bank : 0x01
Address : 0x40022080
Size : 4 Bytes

██████████████████████████████████████████████████ 100%


PROGRAMMING OPTION BYTES AREA ...

Bank : 0x00
Address : 0x40022020
Size : 108 Bytes

██████████████████████████████████████████████████ 100%



Reconnecting...
Reconnected !


UPLOADING OPTION BYTES DATA ...

Bank : 0x00
Address : 0x40022020
Size : 108 Bytes

██████████████████████████████████████████████████ 100%

Bank : 0x01
Address : 0x40022080
Size : 4 Bytes

██████████████████████████████████████████████████ 100%

OPTION BYTE PROGRAMMING VERIFICATION:

Option Bytes successfully programmed
Time elapsed during option Bytes configuration: 00:00:01.274

 

 

To summarize, there are multiple issues here:

  1. STM32_Programmer_CLI should accept quotes Option Bytes if they have additional descriptions in them.
  1. STM32_Programmer_CLI should have aliases for the actual name without the description.
  1. STM32CubeProgrammer should not hang if STM32_Programmer_CLI returns an error.
KouthairBest answer
ST Employee
June 30, 2026

Hello ​@crasbe  & ​@elektronik_BP ,
This issue has been fixed in STM32CubeProgrammer v2.23. You can download it via this link.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.