cancel
Showing results for 
Search instead for 
Did you mean: 

Read wrong content of MCU's internal flash

AlexHalf
Associate III

Hello

I am working in dual bank mode with STM32G474RET6 MCU. 

I want to store some default values in internal flash beyond last programmed firmware's data address.

For example I have following contents in flash (shown from STM32CubeProgrammer):

AlexHalf_0-1704730435486.png

Data starting at address 0x0804B040 (default values I stored) read as 0xFF. While data before this address as 0x41, 0x53 and etc.. is read correctly.

I tried to store defaults values even at the last blank page starting from address 0x0807F800, but also the same phenomenon - even I verify that it stored correctly - it is read as 0xFF.

Tried to read values with debugger - and in this mode it is working and read correctly.

What could be the problem? Is it some kind of issue with linker and etc??

Please suggest me a solution.

 

My read code for testing:

#define FLASH_DEFAULTS_FLAG_ADD 0x0804B040
#define FLASH1_DEFAULT_VAL_ADD 0x0804B041
#define FLASH2_DEFAULT_VAL_ADD 0x0804B042

uint32_t flash_address ;
__IO uint8_t read_data = 0;

if (HcArg == 0)
flash_address = FLASH_DEFAULTS_FLAG_ADD;
else if (HcArg == 1)
flash_address = FLASH1_DEFAULT_VAL_ADD;
else if (HcArg == 2)
flash_address = FLASH2_DEFAULT_VAL_ADD;
else flash_address = FLASH_DEFAULTS_FLAG_ADD;
read_data = *(__IO uint8_t *)(flash_address);

 

Thank you.

 

Alex

10 REPLIES 10

FB_MODE in SYSCFG_MEMRMP ?