Page 1 of 1

UART RX wake after STOP MODE

Posted: Fri Jun 13, 2014 9:43 am
by DeusExMachina
I cant wake up from UART RX

Code: Select all

static const mfEXTConfig extcfg =
{
      {
            {EXT_CH_MODE_DISABLED, NULL},                                          //0
            {EXT_CH_MODE_DISABLED, NULL},                                       //1
            {EXT_CH_MODE_DISABLED, NULL},                                       //2
            {EXT_CH_MODE_BOTH_EDGES | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOA, uart_cb},   //3 UART2 Rx
            {EXT_CH_MODE_DISABLED, NULL},                                       //4
      ...   
      }
};


Although it works for RTC this dose not work for external RX line.
Also I had a question -> after going to sleep (STOP MODE)

Code: Select all

     SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
     PWR->CR |= (PWR_CR_PDDS | PWR_CR_LPSDSR);
    __WFI();

Should I return to code line after __WFI() function? I never reach this point

Re: UART RX wake after STOP MODE

Posted: Fri Jun 13, 2014 9:44 am
by DeusExMachina
sorry, I forgot to mention that I use stm32F051 MCU

Re: UART RX wake after STOP MODE

Posted: Fri Jun 13, 2014 9:55 am
by DeusExMachina
Also I understand that when RTC wakes up MCU it resets :( May be someone has working example for stm32F051Discovery? Looks frustrating.

Re: UART RX wake after STOP MODE

Posted: Fri Jun 13, 2014 10:08 am
by Giovanni
Never personally used sleep modes, sorry.

Giovanni

Re: UART RX wake after STOP MODE

Posted: Tue Jun 17, 2014 3:46 am
by DeusExMachina
I was able to wake up after STOP mode using PWR_EnterSTOPMode function from STD periph. lib.
I can wake up from EXTi port line and RTC line. But!
I can wake up from RTC alarm only once. Something is wrong with RTC alarm, I tried to set RTC registers manually to reinit it, but with no success.
The alarm settings is correct - without sleep it fires periodically, but after wake up alarm doesn't work.
How to correctly reinit RTC and its clock source?

Re: UART RX wake after STOP MODE

Posted: Tue Jun 17, 2014 8:10 am
by DeusExMachina
I solved wake up issue just setting

Code: Select all

       /* Enable the Backup Domain Access */
       PWR->CR |= PWR_CR_DBP;

after waking up. After this manipulation new alarm can be fired.