RTC Calibration with Cerberus

Recently I discovered that cerberus RTC timer is inaccurate. I never needed an accurate time but in my last application I need an accurate timekeeping. The board have accumulated 2 minutes in 1 week. In the reference manual of STM32F40X I read that is possible to perform a smooth calibration to achieve better results but I’ve no idea how to perform this task with cerberus. Can onyone help me? A code portion is also welcome :smiley:


What does the reference manual say? Are there trimming registers?

isn’t temperature stability a big factor in rtc accuracy?

I prefer to use a GPS receiver when time accuracy is required.

if the accuracy is not very critical and the deviation is stable you could read the time from the RealTimeClock e.g. every hour, add the deviation and write the corrected time back to the RealTimeclock.

I worked all day on the RTC experimenting native code for understand how it works. But nothing.
In my application the accuracy is not critical but I must contain the deviation. No network available to get the correct time froma NTP server so I can’t have a reference time. The only thing I can do (I suppose) is calibrate the RTC so that the deviation is minimized.
How can I manage this? Any Idea?

@ cyberh0me - GPS is not applicable (cost issue), trimming register: I do not know the calibration procedure and the documentation provided by ST is not very clear about it. Then, if I find a working procedure, I should be able to do it in C # and I think that it’s not so simple.

So then the correct thing to post is along the lines of: “Hey everyone, I found this reference on ST’s site (insert URL here) Page XX has what I think is the relevant start information, but I don’t know how to interpret it. Anyone familiar with this kind of information that can help me understand it? And then once we establish the correct registers and procedure, can anyone tell me how to manage that in my C# app?”

@ Brett - This would be a fantastic scenario :wink: The very best scenario, but I’d settle for just a tiny piece of C code where the registers to be used are shown from anyone who has already faced this kind of problem.


@ Cybernox - Sounds like a lot of work, for a little gain, when there are solutions like this out there,
For a little over $2 per module, oddwires has a ds1307 real time clock that interfaces to your micro via I2C. That was just based on a 30 second google search, and I know there are others out there like it, so why fight trying to calibrate it, when I agree things like temperature, voltage levels, even what the code is doing in the micro throw your time off…
Not to mention, it comes complete with a battery to keep time if there is a power interruption to the system.

The DS1307 drifts. Better to look at the DS1338 which is pin and register compatible. There are also other RTC’s from Maxim that are far more accurate.

@ Dave McLaughlin - Appreciate the info, as I’m still looking at integrating one into my designs, as currently am relying solely on an internet connection to get the correct time.

Maxim, the very first design I did, I incorporated a maxim part, (I think it was a rs232 level shifter, but that was years ago), and learned the hard way how Maxim maintains inventory. That said, Ironically, several years later, I ended up working for a company that was the 2nd or 3rd biggest purchaser of the DS18b20, (depended on the year), so very familiar with supply issues, but the technology.

So, years later, I find myself back in the same situation, using Maxim parts simply because they do things nobody else does, but the caveat is, I still run into inventory issues.