cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 RTC Fixed to 21st Century?

Jamie Bayley
Associate II

Hey everyone.

During my work with the RTC on the STM32H753, I've noticed that you can't set the century or millenium in the Date Register (RTC_DR). Is this correct?

Therefore, I can infer that the hardware is hardcoded to work within the 21st Century, and that it won't account for leap years beyond the turn of the next Century. Is this also correct?

Although this won't be a problem for a long time, I'm seeking some clarification as we're exploring using these chips in Spacecraft, where this is important.

Unfortunately the datasheet is not explicit about this.

Cheers,

Jamie

6 REPLIES 6
TDK
Guru

The reference manual gives more specific information on how the chips work. In the RTC date register, you can see the year is stored as only two digits, so you will need to infer the upper two. They don't need to be fixed though. You could set the range from 1980-2079, for example, by calculating the top two digits from the bottom two.

0693W00000GWLWLQA5.png 

I don't know of any spacecraft with a 100+ year mission life. It would be nice, though.

If you feel a post has answered your question, please click "Accept as Solution".
Jamie Bayley
Associate II

Thanks for your swift response. I'm already setting the Year Units and Year Tens as shown here.

I understand that you could set a range from before the turn of the millennium like you suggested. Yet you could not set a range that moves beyond 2100, due to 2000 being a leap year and 2100 is not. This is a limitation of not being able to set the Year Hundreds and Year Thousands, which other hardware we've analysed does support.

The reference manual states that it supports Automatic Correction for 28, 29 (lear year), 30 and 31 day months. Thus we can infer that the RTC on this chip treats YU and YT values of 0 as if it is the year 2000, which is a leap year. As this is not stated explicitly anywhere that I've looked.

Thank you for clarifying though. The aim is to future proof our codebase, incase it's still being used upon the turn of the next century. If a mission is launched using part of our codebase near the 2100 mark then things could go wonky.

Paul1
Lead

Thought: Use an external 32bit raw RTC, advantages:

  • May use less power since simpler circuit
  • Raw 32bit counter can rollover forever
  • Raw 32bit count is compact for transmission/logging yet has maximum bit efficiency for long time period.
  • You can interpret the time based on seconds since device started, and post convert to date, so truly independent of artificial leap years, leap seconds, etc. This may be better for timing calculations in space.
  • Some of these ICs will have alarm outputs that could be used to periodically wake STM MCU, allowing even lower power operation. You could even have a circuit that completely removes power from MCU till triggered by this RTC, then sleeps again when MCU chooses to power down fully.
  • Investigate RTCs that use both MEMs and Crystal based oscillators, they will have different susceptibilities but I don't know which is best for your project's space environment, vibration, life span, temperatures, etc.
  • Incorporate ways to calibrate and correct for drift due to temperature fluctuations, given the long time -and/or- have the earth side just record device time and tag with matching current earth time periodically. Relativity effects on time may need consideration at some point. I suggest just logging the raw 32bit count, temperature, device location, and earth time - that would allow post processing corrections without having to "undo" corrections does within device, while simplifying device.
  • In a catastrophic fail (i.e. neutrino hit causing a bit flip) the 32bit count could restart or jump and that could be detected and accounted for in post processing, while a traditional RTC with date and leap year would now have incorrect date and need much more complex post processing.

*I worked with long life battery powered tiny fish & bird electronic archival tags so have designed circuits with some similar requirements.

Paul

Guillaume K
ST Employee

we're exploring using these chips in Spacecraft

I don't think STM32s are qualified for Space use.

Our aim is to make Space more accessible and affordable by using commerical, off the shelf components and Open Sourcing our design and software.

Check out our website if you're interested: https://www.opensourcesatellite.org/

Paul1
Lead

MEMs RTC = DS3232MZ+

Binary RTC (Raw 32bit) = DS1682S+, more... Binary Real Time Clocks | Newark Canada