AnsweredAssumed Answered

STM32L053 discovery standby

Question asked by crocker.lee on Jul 20, 2015
Latest reply on Jul 20, 2015 by crocker.lee
I write some code that seems to successfully put the chip into standby mode:

    while (1) { __asm("WFI")__; }

That seems to stop everything as expected. When I press the black reset button on the discovery, my code restarts as expected, but does not detect that it came out of Standby:

    if (0 != (PWR->CSR & PWR_CSR_SBF)) {
        from_standby = 1;
        PWR->CR |= PWR_CR_CSBF;
    . . .

The flag "from_standby" is never set here. What I'm trying to do is keep the chip in Standby most of the time, but when I come out I want the RTC to be valid. It's running on the LSI, so it should be OK, but since my code always thinks this is the first power-on, it sets the RTC rather than just enabling it.

Is the black button on the discovery more than a reset, or is there something else I'm missing?