-
• #2
Well, if you want to access the RTC directly, you'll have to use the peek and poke functions. In terms of external synchronisation, I'd really consider just soldering on a 32kHz crystal - that'll save you a whole bunch of time and should be more than accurate enough for pretty much everything.
Having said about accessing the RTC directly, on the Espruino Board the value from
getTime()
comes from the RTC (via a special arrangement which allows it to be accurate to 1uS). That's not implemented on the F4 yet (because the F4's RTC has a calender, and the F1's has a simple 32 bit counter). Since I've added the Date class, adding the same functionality to the F4 should be relatively easy though, and I imagine that would be the ideal solution - It'll end up being a lot of use to all F4 users. -
• #3
In terms of external synchronisation, I'd really consider just soldering on a 32kHz crystal - that'll save you a whole bunch of time and should be more than accurate enough for pretty much everything.
Maybe I didn't explain myself properly @Gordon. As far as I understand things, the crystal is there to prevent the clock drifting by making sure the frequency is exactly 2^15 cycles per second. That doesn't help much if the micro RTC is off by an hour to start with or has a completely incorrect date/time (e.g. after losing power).
What I am aiming to achieve is to have a datalogger, that is installed in some remote place, automatically update its RTC on start up and then once a day (or more frequently if desired) during long term operation from the GPS timestamp (via serial) and the time pulse pin.
As I have applications in the scientific research and energy domains, I'd like to make it autonomous and as accurate as I can to ensure that data collected from a geographically distributed network of my devices can be reliably compared.
-
• #4
Well, the way Espruino's
Clock
module works is to keep track of the 'real' time and Espruino time when the time is 'set' - which can be done any time. It can then work out the 'real' time whenever it wants to... You could use exactly the same module with the F4.In fact you could do it right now - it just wouldn't be quite as accurate right now as it works of the high speed oscillator.
Goal:
I want to accurately update the STM32F4 RTC:
Some background:
I am using the following hardware
which pretty much looks like this:
So far I have integrated the GPS receiver into my project pretty well and have extended the basic GPS module to include configuration commands and a few other features.
The STM32F407 has a highly capable, built-in RTC which I would like to make use of within the Espruino JavaScript environment.
For the inquisitive, the ST manual on how to use the RTC can be found here.
From what I can see I have the following options to synchronise the STM32F4 RTC:
Questions:
References:
Here are a few interesting links that have edified me somewhat: