Can't WakeUp from StandBy by RTC on STM32F103xB

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

Moderators: barthess, RoccoMarco

User avatar
Spider
Posts: 25
Joined: Tue Nov 27, 2012 10:05 am
Location: Omsk, Russia
Been thanked: 1 time
Contact:

Can't WakeUp from StandBy by RTC on STM32F103xB

Postby Spider » Sun Jul 08, 2018 10:20 am

Hello, all!

I'm trying to build battery device with periodic wakeup by internal RTC or By Button press. Most of all time device in StandBy mode. And I need to wake up every 2 seconds do to some thing and return to StandBy. But Device don't waking up every two seconds, only by Button (rissing edge on PA0-WKUP_PIN).

I'm trying to use code from hal test:

Code: Select all

  palSetPadMode(GPIOA, GPIOA_WKUP, PAL_MODE_INPUT_PULLDOWN);
  ....
  //For Debugging
  palClearPad(GPIOA, GPIOA_PA12);
  palSetPadMode(GPIOA, GPIOA_WKUP, PAL_MODE_UNCONNECTED);
 
  uint32_t tv_sec;
  rtcGetTime(&RTCD1, &timespec);
  /* set alarm in near future */
  rtcSTM32GetSecMsec(&RTCD1, &tv_sec, NULL);
  alarmspec.tv_sec = tv_sec + 2;
  //rtcSetCallback(&RTCD1, alarm_cb);
  rtcSetAlarm(&RTCD1, 0, &alarmspec);

  chSysLock();
  //DBGMCU->CR |= DBGMCU_CR_DBG_STANDBY; 
  PWR->CR = PWR_CR_CWUF | PWR_CR_CSBF | PWR_CR_PDDS | PWR_CR_LPDS;
  PWR->CSR |= PWR_CSR_EWUP;
  SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
  __WFI();

  while(1);


By pressing on Button connected to PA0 - device waking up. But don't waking up periodically.
What I do wrong?

User avatar
Giovanni
Site Admin
Posts: 11376
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 429 times
Been thanked: 361 times
Contact:

Re: Can't WakeUp from StandBy by RTC on STM32F103xB

Postby Giovanni » Sun Jul 08, 2018 12:00 pm

Hi,

There is a contributed example under /testhal/STM32/STM32F4xx/RTC.

Giovanni

User avatar
Spider
Posts: 25
Joined: Tue Nov 27, 2012 10:05 am
Location: Omsk, Russia
Been thanked: 1 time
Contact:

Re: Can't WakeUp from StandBy by RTC on STM32F103xB

Postby Spider » Sun Jul 08, 2018 3:05 pm

Thx, but STM32F1xx haven't periodic RTC configuration. As I understand MCU can wake up from standby mode my Alarm from RTC. But I my case don't.
I rebuild code to wake-up (reset) by IWDG after calling wfi, but this is bad suggestions.
Why RTC alarm not work? May be I must addition LSI configuration before StandBy?

User avatar
Giovanni
Site Admin
Posts: 11376
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 429 times
Been thanked: 361 times
Contact:

Re: Can't WakeUp from StandBy by RTC on STM32F103xB

Postby Giovanni » Sun Jul 08, 2018 4:28 pm

I don't know exactly, I never used standby on those devices.

Giovanni


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 8 guests