G30 Required Pins and Power Modes

As Brett mentioned you need to figure out the load caps for the Xtal including the parasitic capacitance of the board which should be around 4-6 pF as a rule of thumb.

So if you took 5pF as your parasitic capacitance then you get 26pF for the caps for an 18pF xtal.

CL = ((CX1 x CX2) / (CX1 + CX2)) + Cstray
CX1 = 2(CL - Cstray)

CX1 = CX2 = 2(18pF - 5pF) = 26pF

In my humble :joy: opinion using an RTC xtal is the wrong approach for tracking time over a long period for warranty purposes.

Most uCā€™s dont track time overly accurately using an xtal and you will get alot of drift particularly with temperature changes.

You should look at using something like a DS3232 RTC IC which has all the necessary load caps etc in the package and will give you far more accuracy.

2 Likes

yes, lots of drift. Yes you can tune; yes you can optimise; but there are better, more reliable ways

Yeah like storing the manufacture date or date of first use, in to something that canā€™t be overwritten.

Then all you have to do is know todayā€™s date and do a datediffā€¦

Seems like a very easy thing to do that someone is trying to make impossibly difficult.

I still need to implement a cycle counter and use the battery RAM as a buffer for when it is powered off.

I will look into an IC for the RTC I have 10+ extra pins

It looks pretty straightforward using 2 i2c devicesā€¦I only need to use the EEPROM once per power on sequence.

What about a smaller one like M41T0M6F STMicroelectronics | Integrated Circuits (ICs) | DigiKey?

Is there any difference in performance that you are aware ofā€™? Running out of footprint room on my PCB so the smaller the better (device housing canā€™t change).

Hm that oneā€™s crystal is external though might be bigger

This is a slightly different version but I think Iā€™ll order this to get my drivers working for it

https://www.digikey.com/product-detail/en/adafruit-industries-llc/3013/1528-1598-ND/5875808

@Justin How strenuous would it be to power one of those RTC ICā€™s as well as the RAM on the G30? Even though I may get an IC to keep more accurate track of the time, I still need RAM for my cycle counter buffer.

Comes down to how accurate and temperature stable you want it to be.

You want to look at the datasheets for Accuracy Ā±2ppm from 0Ā°C to +40Ā°C

You could use something like this https://www.digikey.co.nz/product-detail/en/stmicroelectronics/M41T62LC6F/497-11275-1-ND/2673274 which is a very small package and has the xtal and load caps in the package but it wont be as accurate as the DS3231/2 it has an accuracy at 25Ā°C Ā±10ppm which is ~52 seconds per mont

Current for both operations are in the low uA range so wont be a problem.

And dont forget depending on how the board it layout out your battery backup supply is only being consumed when the board is not being powered.

what does ppm mean? how do you get 52 seconds from that? So every month the time will lose 52 seconds of accuracy? That is more than enough I thinkā€¦in 5 years it will only be about an hour offā€¦I just need it accurate to a couple days.

Parts per million

Xtal has a Ā±10ppm accuracy

Soā€¦

86400 (sec per day) x (20 / 1000000) = 1.728s per day

Ok thank you I have never seen ppm used with time before always just in chemistry, makes sense though thank you. I think Iā€™ll go with that little bitty guy you suggested.

You could use the DS3232M, it comes in a SO8 SMD-package. I have a clock running with that a DS3232M for nearly two years now and the time-deviation is less than 1 second compared to a similar clock that updates itself via NTP, so that should be accurate enough. But the conditions are good, so in my case there are no large temperatur-differences since they are in a room with always about 20Ā°C.

But I think itā€™s pretty hard to protect such a warranty-keeping-system against manipulation. E.g. what happens when the battery is removed or empty (intentionally, accidentally or by mistake so the RTC is reset when the device is powered off)? I think, Iā€™d just store the first power-on-date on the EEPROM (and if it has been powered on before, so the MCU knows, if it has to set the date) and increase the number of power-ons also on the EEPROM. In that case it wouldnā€™t be tragic if the time has been reset or the RTC is not accurate (so you could use a cheaper one).

The G30 (the underlaying F401) has an 96bit-unique-ID (I donā€™t know if it can be used with NETFM or TinyCLR) that could be used to identify the device if someone scraped away your serialnumber. Or you could maybe use something like an Microchip 24AA025E64 EEPROM for identification (an extra-chip would maybe be easier to read, if the device is not functional anymore).

When I think about it, itā€™s kind of exiting, what things could be used to safely identify a device and its parameters if there are people, that want to unidentify it :thinking:ā€¦

Can be read easily.

I saw this awhile ago but not sure if it is what you are looking for.