How I can make or demonstrate miliseconds up counter on RTC?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-06 3: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.
- Labels:
-
LoRa
-
RTC
-
STM32L0 Series
-
SysTick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-06 5:31 AM
How about subtracting it from the maximum value ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-06 5: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-06 5:39 AM
thank you, yes but i wonder is there any way without bulk for processor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-06 5:40 AM
Thank you for good explain bro.
