Skip to main content
Graduate
December 15, 2025
Solved

STM32G070 FLASH program at negative temperatures

  • December 15, 2025
  • 2 replies
  • 83 views

Hi everyone!

Could someone help me to understand a problem with STM32G070.
We have deployed approx. 50-60 devices with stm32g070 MCU that saves some parameters in FLASH every 24 hours. I know that according to datasheet FLASH memory endurance for this MCU is 1000 cycles. So, in theory, this MCU can work normally 2.7 years. It is also worth to mention that this period is defined for temperature range of -40 to +85°C. Recently, we had a relative cold weather with a temperature ranging from 0 to -10°C. This is far from -40°C that we see in datasheet. However, we had 5-6 devices that have corrupted parameters area (last page from 128K FLASH memory).

I was able to reproduce this situation in the office. So I wanted to ask you guys if you had such a strange behavior with this MCU or another one. I need to mention also that this board is coated with special waterproof-coating.

Erase and program functions looks like that:

HAL_FLASH_Unlock();

uint32_t defectPages;
FLASH_EraseInitTypeDef EraseInitStruct = {0};

EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES;
EraseInitStruct.Page = FLASH_PAGE_NB - 1; // 63 - last page
EraseInitStruct.NbPages = 1;

HAL_FLASHEx_Erase(&EraseInitStruct, &defectPages);

uint32_t Address = FLASH_BASE + FLASH_SIZE - FLASH_PAGE_SIZE;
while (Address < FLASH_BASE + FLASH_SIZE)
{
 HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, Address, 0xECABCDEFECABCDEF);
 Address += 8U;
}

Interesting is that Erase function works good even at -40°C, but not the Program.
So I thought maybe I'm missing something in my Erase/Program sequence?

VCC and HSI are stable.
HAL for stm32g0 version is 1.6.2.

Any help would be appreciated.
THX

    This topic has been closed for replies.
    Best answer by Zed

    Hi everyone!

    The problem is solved.
    It appears that we forgot to switch Vcore from 1.0V to 1.2V, that is why we couldn't save new data in FLASH at negative temperatures. At this level of Vcore we shouldn't try it in the first place.

    Anyway, thank you for your help!

    2 replies

    Technical Moderator
    December 16, 2025

    Hello,

    For that question better to ask your local FAE for an efficient support as it could be a quality issue which could not be handled in the community.

    Thank you.

    ZedAuthorAnswer
    Graduate
    December 20, 2025

    Hi everyone!

    The problem is solved.
    It appears that we forgot to switch Vcore from 1.0V to 1.2V, that is why we couldn't save new data in FLASH at negative temperatures. At this level of Vcore we shouldn't try it in the first place.

    Anyway, thank you for your help!