STM32F407-Discovery RTC Sleep mode problem Topic is solved

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

Moderator: RoccoMarco

Post Reply
luciano.rdrgz
Posts: 4
Joined: Tue Apr 26, 2016 7:44 pm
Has thanked: 2 times

STM32F407-Discovery RTC Sleep mode problem

Post 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!
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F407-Discovery RTC Sleep mode problem

Post 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
luciano.rdrgz
Posts: 4
Joined: Tue Apr 26, 2016 7:44 pm
Has thanked: 2 times

Re: STM32F407-Discovery RTC Sleep mode problem

Post by luciano.rdrgz »

Thanks a lot!
Now it's working with the internal RTC :D

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!
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: STM32F407-Discovery RTC Sleep mode problem

Post by Giovanni »

Hi,

There a non volatile RAM in the STM32 and non volatile registers in the RTC, you could use those.

Giovanni
luciano.rdrgz
Posts: 4
Joined: Tue Apr 26, 2016 7:44 pm
Has thanked: 2 times

Re: STM32F407-Discovery RTC Sleep mode problem

Post 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!
luciano.rdrgz
Posts: 4
Joined: Tue Apr 26, 2016 7:44 pm
Has thanked: 2 times

Re: STM32F407-Discovery RTC Sleep mode problem

Post by luciano.rdrgz »

Ohh! It was easy! I finally can do it! :D
Thanks for all!
Regards
Post Reply