Page 1 of 1
STM32F407-Discovery RTC Sleep mode problem
Posted: Tue May 31, 2016 11:37 pm
by luciano.rdrgz
Hi,
I need help with my STM32F407-Discovery. I'm using the board as an endpoint application and i need to take it to a low power mode for a period of time. Then it must wake up, make some process and go to sleep again.
I tried compile de RTC example but it fails:
#error "LSE frequency not defined"
#error "STM32_LSECLK outside acceptable range (STM32_LSECLK_MIN...STM32_LSECLK_MAX)"
any suggestions?
Thanks!
Re: STM32F407-Discovery RTC Sleep mode problem
Posted: Wed Jun 01, 2016 8:06 am
by Giovanni
Hi,
Your discovery does not have a 32kHz oscillator so the RTC cannot work, this is the error you see.
You need to configure RTC to use the internal oscillator (low precision) in mcuconf.h, see the RCC/Clocks section of the STM32 Reference Manual for details.
Giovanni
Re: STM32F407-Discovery RTC Sleep mode problem
Posted: Wed Jun 01, 2016 10:53 pm
by luciano.rdrgz
Thanks a lot!
Now it's working with the internal RTC
I also have another question:
I have a variable in my code (uint8_t) which represents a counter. The problem is that when it wake up again this value is reset. Is there any way to prevent it? Where i can save this value before taking to sleep?
When it wake up the code starts from the begining, doesn't it?
Thanks!
Re: STM32F407-Discovery RTC Sleep mode problem
Posted: Thu Jun 02, 2016 7:08 am
by Giovanni
Hi,
There a non volatile RAM in the STM32 and non volatile registers in the RTC, you could use those.
Giovanni
Re: STM32F407-Discovery RTC Sleep mode problem
Posted: Thu Jun 02, 2016 9:02 pm
by luciano.rdrgz
Hello!
Perfect!
I prefer to use the registers because i need to save only a 16 bits value (counter) and using the RAM will increase the consumption, isn't it?
Could you give me an example reading/writing one of this registers? Because i tried with the support functions described in this post with no success:
http://www.chibios.com/forum/viewtopic.php?t=2271
Thanks a lot for your time!
Re: STM32F407-Discovery RTC Sleep mode problem
Posted: Fri Jun 03, 2016 4:50 pm
by luciano.rdrgz
Ohh! It was easy! I finally can do it!
Thanks for all!
Regards