cancel
Showing results for 
Search instead for 
Did you mean: 

option bytes programming

Venkatesh-8559
Associate II

Hi,

I want clarification on STM32 option byte programming.

When we write new values to FLASH_OPTR and other option registers:

Where are these FLASH option registers physically located?
Are they inside the FLASH peripheral (0x4002xxxx region) and not in the option byte Flash area (0x1FFF8000)?

When OPTSTRT is set, does the CPU erase/program the option byte pages, or does the FLASH controller hardware automatically erase the option byte Flash area and program it using the values in the FLASH option registers?

I want to clearly understand the internal flow between:

Option byte Flash memory

FLASH option registers

FLASH controller hardware

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Super User

The FLASH registers (0x4002xxxx region) are an interface to the option bytes. The bytes themselves are stored in non-volatile memory (0x1FFF8000 region).

At startup, the FLASH registers are populated based on the non-volatile values.

> When OPTSTRT is set, does the CPU erase/program the option byte pages, or does the FLASH controller hardware automatically erase the option byte Flash area and program it using the values in the FLASH option registers?

The chip erases and then programs the non-volatile memory only when OPTSTRT is set. If you don't set this, the option bytes are not changed. Nothing is done automatically.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

1 REPLY 1
TDK
Super User

The FLASH registers (0x4002xxxx region) are an interface to the option bytes. The bytes themselves are stored in non-volatile memory (0x1FFF8000 region).

At startup, the FLASH registers are populated based on the non-volatile values.

> When OPTSTRT is set, does the CPU erase/program the option byte pages, or does the FLASH controller hardware automatically erase the option byte Flash area and program it using the values in the FLASH option registers?

The chip erases and then programs the non-volatile memory only when OPTSTRT is set. If you don't set this, the option bytes are not changed. Nothing is done automatically.

If you feel a post has answered your question, please click "Accept as Solution".