2019-11-06 03:46 AM
Hello to everyone,
I am reading time with RTC on my board but milisecond is downcounter as mention on datasheet. I need to see milisecond to up counter on serial port. How can i do it?
Thanks.
2019-11-06 05:31 AM
How about subtracting it from the maximum value ?
2019-11-06 05:37 AM
The RTC subseconds register is the counter for the RTCCLK synchronous prescaler. Read the RTC->PRER register and extract the lower 15-bit bits for the prescaler period. When you read the subseconds down counter, subtract the value from the prescaler period. That's your up counter in units of whatever the RTC sync frequency is.
You still have to convert from prescaled RTCCLK tick to actual milliseconds. As an example, given a 32.768KHz LSE as the clock source, the async prescale is 32 and sync prescale is set to 1024 (close to 1ms). When you read subseconds you get a down count from 0 to 1023. Subtract it from 1023 to get the up count. For actual milliseconds it's simple algebra: upcount * 1000 / 1024 = ms upcounter (and remember your numerical analysis course...always multiply before dividing).
Jack Peacock
2019-11-06 05:39 AM
thank you, yes but i wonder is there any way without bulk for processor.
2019-11-06 05:40 AM
Thank you for good explain bro.