0
\$\begingroup\$

I've got a board with STM32F103C8T6 and a 32.768 kHz external crystal.

The RTC module of STM32 is used as a calendar as I set the prescaler to 32767.

But, to reach the minimum power consumption, I also want the RTC module to wake up my MCU alternatively(about 10ms per time, high accuracy is not required), how can I do it?

\$\endgroup\$
  • \$\begingroup\$ You want a wakeup every 10 ms? This does not sound hard anyway, there must be a lot of example for this task. If I understand correctly the RTC is already up and running, right? Also what library do you use, SPL, HAL or none? \$\endgroup\$ – Bence Kaulics Sep 17 '16 at 13:14
  • \$\begingroup\$ I use SPL ,the problem is I have already configured the prescaler of RTC to 32767 to make the RTC counter count the second num. \$\endgroup\$ – user123179 Sep 17 '16 at 13:26
  • \$\begingroup\$ I do not think if that would be a problem. Unfortunately I am not familiar with SPL but this RTC lib looks quite promising. github.com/nitsky/stm32-example/blob/master/stm32/periph/src/… . I think you can have a basic concept from it and port it to F1 as this code is written to F3. \$\endgroup\$ – Bence Kaulics Sep 17 '16 at 14:43
  • \$\begingroup\$ are you trying to wake from sleep, stop, or standby mode? if sleep, you can use any on chip timer, instead of RTC. \$\endgroup\$ – Mark Ch Sep 17 '16 at 14:53
  • \$\begingroup\$ My device runs FreeRTOS on 12Mhz, I added __WFI() to idle hook,which means device runs into sleep mode when there is no task to run, but the power consumption in this case is still too high(4mA), so I want to set my MCU into stop mode to reach minimum consumption. \$\endgroup\$ – user123179 Sep 18 '16 at 2:25
0
\$\begingroup\$

If you already set up the RTC to count seconds for your calendar and do not want to change that, then what you asking is not possible.

However, if you ready to change some stuff then you might be able to count milliseconds or 10 milliseconds, and setup the alarm irq to waking up your device from stop mode. Once your device is awake then you add the among of millisecond to your calendar and should work.

| improve this answer | |
\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.