cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G07 changing options bytes by program fails !

Mr_M_from_G
Senior II

I try to change the option bytes of a STM32G070R from my program. i think I did everything a written in the doc:

  • clear FLASH_CR_LOCK with the FLASH->KEYR sequence and wait till it is clear
  • clear FLASH_CR_OPTLOCK with the FLASH->OPTKEYR sequence and wait till it is clear
  • set FLASH->OPTR to the new value
  • wait till all busy bits in FLASH->CR are clear
  • set FLASH->CR = FLASH_CR_OPTSTRT (or only set bit FLASH_CR_OPTSTRT)
  • wait till BSY1 in FLASH->CR is clear
  • set FLASH_CR_LOCK and FLASH_CR_OPTLOCK
  • reset the device and check FLASH->OPTR

but it is unchanged

I think the problem is right after setting FLASH->OPTR, reading it back then also returns the old value.

I wanted to check HAL functions but I can't find any FLASH_EX for it. I have G0 series package 1.3.0 which seems to be the latest.

It works with Cube programmer via SWD and UART = bootloader.

Which is the command via UART to bootloader to change option bytes? I can't find it in AN3155.

Thanks for any help.

0 REPLIES 0