Skip to main content
Explorer
August 7, 2026
Question

STM32F407 STOP MODE FAILURE

  • August 7, 2026
  • 1 reply
  • 65 views

Hi everyone,

I am facing a bizarre issue with an STM32F407 running a custom PCB. I am trying to put the MCU into STOP mode (Low Power Regulator ON), but it seems to enter deep sleep for a fraction of a second (current drops to almost 0mA) and then immediately wakes up/resets, stabilizing at a constant 9.8mA.

I am programming via DFU and using a custom bootloader that jumps to the main application at 0x08010000.

Here is what I have already done in my "Deep Sleep Test" routine to isolate the issue:

  • Hardware Isolation: All external peripherals (W25Q Flash, FRAM, LDOs) are completely disconnected or powered down. The 3.3V line is isolated.

  • GPIOs: All GPIOs are set to GPIO_MODE_ANALOG, except for specific pull-up/pull-down pins strictly required by the hardware.

  • USB PHY: I am explicitly disabling the internal USB transceiver using USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_PWRDWN; and then disabling the clock.

  • Interrupts & SysTick: I disable SysTick->CTRL = 0, clear SCB->ICSR, mask all EXTI lines (EXTI->IMR = 0), and explicitly disable/clear all NVIC lines using NVIC->ICER[i] = 0xFFFFFFFF and NVIC->ICPR[i] = 0xFFFFFFFF.

  • RTC/Watchdog: I freeze the IWDG in STOP mode using __HAL_DBGMCU_FREEZE_IWDG(); and I force a backup domain reset to clear any ghost RTC wakeups.

Despite all this, calling HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); inside a while(1) loop results in a momentary drop to 0mA, followed by an immediate return to 9.8mA.

My suspicion is that the custom bootloader is leaving some peripheral active or a pending flag that completely bypasses my NVIC disabling, or I am triggering a Brown-Out Reset during the current drop.

Has anyone experienced this "instant bounce" back to 10mA on the F4 series? What hidden registers should I check before calling WFI?

Thanks in advance for any pointers!

1 reply

ST Technical Moderator
August 27, 2026

Hello ​@maxtisc 
Sorry for the late reply.
Usually, this kind of issue results from a hardware problem or, as suggested, a code issue.
To troubleshoot this issue, first try the firmware example. It is a simple project that puts the MCU in low-power mode.
If the example does not work correctly, the hardware is likely faulty. Common causes include an unconnected ground, a floating pin, or a similar hardware issue.
If the example works correctly, focus on the software. Immediate wake-up from low-power mode is a common issue.
It is usually caused by a wake-up or reset source is not fully cleared or a bootloader handoff problem. 
I suggest that you read the following registers immediately after reset or wake-up:
RCC->CSR reset flags
PWR->CSR or wake-up flags
EXTI->PR pending bits
RTC wake-up or alarm flags Whether the vector table is correctly set to 0x08010000

BR
Gyessine

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.