AnsweredAssumed Answered

STM32F105 flash erase problem

Question asked by baranov.yury on Jun 16, 2017
Latest reply on Jan 9, 2018 by boyd.bruce

Hello!

Got a weird problem with STM32F105R8T6 chip

While the same code, compiled and running on  STM32F103R8T6, works ok

 

Program size is 17 kB as can be seen from map file:

AHBPrescTable 0x0800473a Data 16 system_stm32f1xx.o(.constdata)
Region$$Table$$Base 0x0800474c Number 0 anon$$obj.o(Region$$Table)
Region$$Table$$Limit 0x0800476c Number 0 anon$$obj.o(Region$$Table)
stTac_TO 0x20000028 Data 8 stm32f1xx_it.o(.data)

 

I'm attempting to erase flash page located well above the program at 32 kB with the following code

HAL_FLASH_Unlock();
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGERR);
EraseInitStruct.TypeErase = TYPEERASE_PAGEERASE;
EraseInitStruct.PageAddress = (uint32_t)(0x08008000);
EraseInitStruct.NbPages = 1U;
EraseInitStruct.Banks = FLASH_BANK_1;
HAL_FLASHEx_Erase(&EraseInitStruct, &SectorError);
HAL_FLASH_Lock();

Flash content erases ok, and I can write new data 

HAL_FLASH_Program(TYPEPROGRAM_HALFWORD,(uint32_t)(0x0800C000), const1);

The data is read back ok

 

Application runs ok, however it halts after reset

 

If I write protect pages 32...35 , the data is not erased, the application works normally after reset

Weird thing however is that there's no application data or code above 0x0800476C as can be seen from the MAP file

 

Am I missing something?

Outcomes