UART RX wake after STOP MODE

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

UART RX wake after STOP MODE

Post 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
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: UART RX wake after STOP MODE

Post by DeusExMachina »

sorry, I forgot to mention that I use stm32F051 MCU
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: UART RX wake after STOP MODE

Post by DeusExMachina »

Also I understand that when RTC wakes up MCU it resets :( May be someone has working example for stm32F051Discovery? Looks frustrating.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: UART RX wake after STOP MODE

Post by Giovanni »

Never personally used sleep modes, sorry.

Giovanni
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: UART RX wake after STOP MODE

Post 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?
User avatar
DeusExMachina
Posts: 223
Joined: Tue Apr 03, 2012 5:08 am
Has thanked: 3 times
Been thanked: 3 times

Re: UART RX wake after STOP MODE

Post 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.
Post Reply