Skip to main content
Barber.Mark
Associate III
June 19, 2026
Solved

STM320B1RE cannot erase page 127 on 256k version

  • June 19, 2026
  • 1 reply
  • 38 views

i am using a 256K flash version of the STM32G0B1RE. part of the code is to use page 127 for various settings. when the device first starts up i set these settings at address 0x0308F800 this works perfectly. when i update a settings i erase page 127 then write the new settings. For some reason i cannot erase page 127, i am using single BANK mode, i think. when i pause to examine registers and memory i cannot see all the bits in the FLASH register. Suspect there is an issue with the svd file.

i have used this technique successfully on other CPU versions so i am confident the basic code works. i think i am missing something around the 1 bank or 2 bank settings for this processor.

any help appreciated. 

Mark

Best answer by Barber.Mark

Not to be beaten i found the problem. Leaving a comment here for anyone else. The STM32G0B1 device is set to dual bank mode by default. To get it to single bank mode you need to use STM32CubePrg, goto Option Bytes->User Configuration then look for the option bit “DUAL BANK” it is selected by default clear it. then exit. i am sure this option byte can be changed programmatically but for the moment this works.  

1 reply

Barber.Mark
Barber.MarkAuthorBest answer
Associate III
June 19, 2026

Not to be beaten i found the problem. Leaving a comment here for anyone else. The STM32G0B1 device is set to dual bank mode by default. To get it to single bank mode you need to use STM32CubePrg, goto Option Bytes->User Configuration then look for the option bit “DUAL BANK” it is selected by default clear it. then exit. i am sure this option byte can be changed programmatically but for the moment this works.