Skip to main content
Geoffrey1
Associate III
August 1, 2026
Question

Flash writes fail after exiting stop3 on stm32u375

  • August 1, 2026
  • 0 replies
  • 44 views

I have an application that uses internal flash for logging.  Unfortunately, after exiting stop3 subsequent writes to flash fail.  Here’s my exit code -- the names of the routines should give a general idea.  I don’t really have a clue what changed and the reference manual is notably sparse on details about the various stop/standby/shutdown modes

 


SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));

__DSB();
__WFI();
__ISB();

CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
PWR->APCR &= ~PWR_APCR_APC;
palSetLine(LINE_testpin);

chSysLock();
tagPowerRestoreClocksAfterStop3();
tagPowerPostStop3WakeEventI();
chSysUnlock();
// Ensure Flash is awake and not stuck in low-power mode
FLASH->ACR &= ~(FLASH_ACR_SLEEP_PD);
__DSB();