2016-12-08 11:29 AM
Hi,
In the scheduling system we use we need a simple 32kHz low power counter value.
Exactly like in the stm32F1 family is present.
But in any other family, the RTC registers are replaced by Time and Date registers.
I am able to covert the Time register back to a counter value that overflows every 24 hours and add the number of days.
This way I can get a 32 bit counter value running at 32kHz.
But it is an enourmous hassle and it takes a lot more processing time than needed.
Is there a simple way to get a low power 32kHz counter value, so we can use it for our scheduling?
We aim to disable the HSI/HSE/PLL clocks when no tasks needs to run, but keep de Low power LSE/LSI running to wakeup from stop mode.
We do not need any timestamp values like year month day hour minute second.
Thank you!
2016-12-08 01:58 PM
The new designs use a calendaring RTC that uses BCD counters, there isn't a free running counter any more. There is usually one TIM connected to the LSI or LSE clock, but is not low power.
2016-12-08 02:10 PM
Can you explain a bit more in detail what are you actually trying to achieve? Why do you need the counter etc.? Maybe there is another solution, but from your description it's not clear, what is your app doing. Which device are you using etc.
Do I understand that you put your device into sleep and you need a 'timer' running while asleep to wake up the device after some defined time or so?
Otherwise the answer is simply no, the register is not present anymore. I guess because the F1 was the very first device, it was designed this way and the next devices contain the Time/Date registers. Honestly what I would expect from an RTC unit, that it will contain these Date/Time registers instead of an counter register so I don't have to calculate the date/time over and over again, because that's what I expect from such a peripheral and puts an unnecessary load to do it in SW.
Have a nice day,
Renegade
2016-12-08 03:12 PM
Just to add, some devices include a low power timer... But those are Lx devices if I remember well.
2016-12-09 12:33 AM
I do not need the RTC features. I just need to able to run a timer, and use wake from stop/sleep, without the HSI/E running. From what I understand, the RTC is the only LOW POWER timer.
I can keep it running using an F0 device with ony 5uA current consumption without loss of application functionality.
Our scheduling system determines the number of ticks it can sleep until the next task is due, it forwards this number to the timer and the timer needs to be able to generate an interrupt on that specific time.
I can use a normal timer for this, but then it is not low power anymore.
Most of our applications do not need the date/time features, just a counter is way easier.
2016-12-09 01:06 AM
Martijn,
Several workarounds may be possible:
Renegade,
It was a poor design choice to abandon the counter. How hard it might've been to have implemented both counter and calendar, either in parallel or as a user choosable alternative? Granted, more transistors more consumption, but I believe the difference might've been negligible if approached carefully.
I for one, *do* use the clock/calendar in the 'usual' way, but as I need both UTC and local time simultaneously, the only sane approach is to convert running clock (considered as UTC) to linear ('unixtime' or similar), perform the timezone shifts as needed, and then convert back to calendar/clock - so there's no benefit in keeping calendar/clock in this case either.
JW
2016-12-09 06:37 AM
I too liked the 32-bit counter and the linear progression of time, however I'll observe that very few people can write and test calendar conversions properly, even across a 1901..2099 range where every year divisible by 4 is a leap year.
2017-01-20 01:01 AM
Just to clarify: The year 2000 was not a leap year, even though it is divisible by 4.
I'd rather go with a counter which let's me do my own mistakes than having to fight with a calendar RTC. A calendar RTC makes it almost impossible to implement DST.
2017-01-20 02:22 AM
Just to clarify: The year 2000 was not a leap year, even though it is divisible by 4.
Of course it
https://en.wikipedia.org/wiki/Gregorian_calendar
. 1900 wasn't and 2100 won't be.This mistake may explain why
very few people can write and test calendar conversions properly
JW
[EDIT] Interestingly enough, the year 2000 was
http://www.bluewaterarts.com/calendar/NewInterGravissimas.htm
http://www.bluewaterarts.com/calendar/NewInterGravissimas.htm
:Anno vero
MM
, more consueto dies bissextus intercaletur, Februario diesXXIX
continente, idemque ordo intermittendi intercalandique bissextum diem in quadringentis quibusque annis perpetuo conservetur.2017-01-20 03:13 AM
Got me, you're right. Luckily my calendar implementation knew better than me.
Anyhow, my point about implementing DST on top of calendar RTC remains.