3
\$\begingroup\$

With my STM32 I'm trying to configure a deepSleep mode and use RTC to generate interruption (actually each 30 seconds).

When my STM start, this one configure the RTC and directly go in Stop mode. After 30 seconds the board is waking up and use Serial to configure LoRa Radio module RN2483 with the Serial communication and also use I2C to read and write some datas. But for the configuration of the RN2483, we need to wait response (it take around 3 seconds).

After that the STM go in deepSleep mode again. This is a loop. If this periode between two deepsleep take too much time (due to wait or printf for example) the next deepSleep will be bad configured and the STM never wake up again and the power consumption is high.

Does anyone have any idea ?

Maybe I need to check some deepsleep registers or something like that ?

EDIT: This is a picture of my state machine enter image description here

For the DeepSleep configuration this is my script below

void STM32_DeepSleep(void){
    //Clear bits
    EXTI->PR &= 0xFF840000;
    //Enter in stopmode
    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON | PWR_CR_CWUF | PWR_CR_ULP | PWR_CR_FWU , PWR_STOPENTRY_WFI);
}

After some researches the problem is coming from __WFI() function. Due to a long time before, the __WFI() freeze. Maybe a watchdog inside the STM32 make the script freeze ?

\$\endgroup\$
  • \$\begingroup\$ This is a rather complex system you're describing. Since we don't know what you do to send the device into stop/deep sleep, we can't really guess what's going on. It's usually a pretty good idea to draw, for one's own clarity of mind, a control flow diagram, and then use a debugger to figure out what happens when one has narrowed down where to look. \$\endgroup\$ – Marcus Müller Apr 12 '17 at 14:08
  • 1
    \$\begingroup\$ @MarcusMüller I add some informations as you said. Thank you for your help. \$\endgroup\$ – Simon NOWAK Apr 12 '17 at 14:44
  • \$\begingroup\$ @MarcusMüller Have you any idea ? I already have this problem, do you need more informations ? \$\endgroup\$ – Simon NOWAK Apr 28 '17 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.