2020-07-24 02:24 AM
in the user manual: Seconds interrupt, for generating a periodic interrupt signal with a programmable.
but it is not as it is with the RTC alarm
Best Regards
Kadir
2020-07-24 03:30 AM
30 ms is quite short for stop mode. I would be tempted to put it to sleep (leave the clocks running) for that.
But if you need stop mode, my comments are:
stm32f103 is quite old, and its RTC is different from the one you will find in most stm32 microcontrollers.
What you might be able to do with the RTC is use the overflow interrupt. You can load RTC_CNT with a value close to overflow (e.g. 0xffffffff) and it will count up. When it overflows to 0x0000000 then you get an interrupt.
How often do these counts occur? At the frequency of the RTC - typically a 32.768 kHz crystal. So one would only be able to generate an interrupt every 30.5 ms. And there would be no way to do any finer control - those counts happen when they happen. If you enter stop mode just before a count is due, you'll get woken up very quickly.
If you want stop mode because you need extremely low power, you might be better off using one of the more modern stm32l family. They are much lower power, and likely to remain available for much longer than stm32f103.
Hope this helps,
Danish
2020-07-24 04:10 AM
Thank you Danish for the fast feedback.
The count should run all the time, i.e. switch off every 30 ms, then start again after 30 ms.
This is for a low power energy model and something is done every 30 ms. do you think this is feasible?
Best Regards
Kadir
2020-07-24 04:39 AM
It won't be 30.0 ms. It will be 30.5176 ms if you're using a 32.768 kHz crystal.
But if you're using the LSI oscillator rather than LSE, it might be anywhere between 16 ms and 34 ms. And will probably suffer from jitter as well as drift with temperature.
If you can live with that, then yes it is feasible.
2020-07-24 05:07 AM
thanks, that helped me a lot