STM32N6 can't wake up from standby on WKUP pin.
I am struggling to wakeup STM32N6570-DK from standby mode with user button (WKUP3).
I created an isolated CMake + VSCode test project and share it in zip file. Based on latest CubeMX 6.17.0 and STM32N6 HAL 1.3.0. There is application and FSBL but I only use FSBL and do not jump into Application. My intention is that after wake-up, MCU launches Boot ROM that launches FSBL.
The core part of the code is:
static void EnterStandbyMode(void)
{
PWREx_WakeupPinTypeDef sWKUPConfigs = {0};
/* Prevent any disturbing interrupts */
__disable_irq();
/* Enable the Wake-up pin functionality */
sWKUPConfigs.WakeUpPin = PWR_WAKEUP_PIN3; /* PC13 (User button) */
sWKUPConfigs.PinPolarity = PWR_PIN_POLARITY_HIGH;
sWKUPConfigs.PinPull = PWR_PIN_PULL_DOWN;
HAL_PWREx_EnableWakeUpPin(&sWKUPConfigs);
HAL_PWR_ClearWakeupFlag(PWR_WAKEUP_FLAG_ALL);
/* AN5946 and errata say that BSEC should be enabled to go stand-by. */
__HAL_RCC_BSEC_CLK_SLEEP_ENABLE();
__HAL_RCC_BSEC_CLK_ENABLE();
/* Set init vector to Boot ROM. */
SYSCFG->INITSVTORCR = BOOTROM_BASE_S;
SYSCFG->INITNSVTORCR = BOOTROM_BASE_NS;
/* Clear previous stand-by flag and go to stand-by */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SBF);
HAL_PWR_EnterSTANDBYMode();
/* Should not get here.
* Turn on red LED (active low) to signal problem */
HAL_GPIO_WritePin(LED2_GPIO_Port, LED2_Pin, GPIO_PIN_RESET);
Error_Handler();
}It blinks the LED as I programmed, goes into standby mode and I can observe PWR_ON signal going low and turning off external regulators. Unfortunately it does not wake up. There is a power consumption increase after the button press, but I have no idea where the MCU stucks because it's not starting up again. I tried setting INITSVTORCR to Boot ROM vector, not setting it and setting it to zero, but no use.
I have read the datasheet, reference manual, errata, app note AN5946, consulted AI, checked examples (standby with RTC wakeup) and read this post: STM32N6 low-power modes and Standby demo - STMicroelectronics Community
I tried changing optimization, placing code into ITCM (and enabled ITCM retention), disabling cache. This test code is without resource isolation (RIF/RISAF), but in the real code I have it enabled and it still doesn't work. OTP fuses are default - as they come with DK. Stand-by mode prevention isn't enabled. The post-build step signs the binary and I program it into external Flash so Boot ROM can launch it without debugger.
Running out of ideas.
There something else strange. After adding "read back" line behind INITSVTORCR writing, MCU does not go to standby, but it does not fall-through to Error_Handler either.
/* Set init vector to Boot ROM. */
SYSCFG->INITSVTORCR = BOOTROM_BASE_S;
(void)SYSCFG->INITSVTORCR;Why I add this? Because I don't know what else to try and Application SystemInit contains such thing. Looking at assembly listing, it doesn't seem to do any harm, yet it breaks things.
