DS3232 vs DS3231: what is this battery backed SRAM - Page 1
Forum section: electronics / projects

author: sylvanoMTL
author_rank: Contributor
timestamp: April 30, 2025, 01:37:40 pm
content: I am trying to figure out in what case I would require to us the battery backed SRAM.Can anyone explain me in simple terms why choosing one over the other?

author: xvr
author_rank: Frequent Contributor
timestamp: April 30, 2025, 01:47:35 pm
content: QuoteNo one can force you to use SRAM.QuoteIf you need store some persistent setup values in your system, but have no available EEPROM to store them.Or if need to store some frequently changing persistent value, and EEPROM endurance will not allow you to store it with required frequency.Or if you utilize very deep sleep mode of main MCU (that will lost all RAM content) and want to store some working variables during sleep.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 30, 2025, 03:52:35 pm
content: It just depends on your needs. Like xvr wrote, when you have some data that needs to be saved over power down cycles, you can either use EEPROM, FRAM, battery backed up SRAM or what other kind of non volatile memory exists.In case of the DS3232 vs the DS3231 it just means that the DS3232 has got some SRAM one can use. Both chips need a battery backup to keep the time up to date.

author: sylvanoMTL
author_rank: Contributor
timestamp: April 30, 2025, 04:58:02 pm
content: Thank you all,I have additional question, regarding the M series: are the DS3231M and DS3232M capped to 1Hz? but offer a smaller packageI found this which seems to confirmhttps://www.analog.com/en/resources/design-notes/feature-comparison-of-the-ds323x-realtime-clocks.html#:~:text=The%20DS3232%2C%20an%20accurate%20I%C2%B2C,I%C2%B2C%20interface%20can%20be%20operated.

author: pcprogrammer
author_rank: Super Contributor
timestamp: April 30, 2025, 06:09:02 pm
content: For what I understand from it, is that the M version uses a different way to generate the internal clock frequency that allows it to be used in environments with a lot of vibrations. The INT/SQW output is limited to 1Hz, where the other devices can output one of four frequencies on this pin. 1Hz, 1024Hz, 4096Hz or 8192Hz. This pin can also be used to generate an interrupt signal on an alarm setting. These settings are made by writing to the registers of the device.So the M version does not have the frequency select option for the SQW output, and like the document you linked to states, it is also available in an eight pin 150mil SOIC package.

author: jwet
author_rank: Frequent Contributor
timestamp: April 30, 2025, 06:20:44 pm
content: The "M" devices use a mems oscillator and are more rugged but have other tradeoffs.

author: sylvanoMTL
author_rank: Contributor
timestamp: April 30, 2025, 06:54:44 pm
content: Alright, so it might be a better candidate for my application (wearable)

author: jwet
author_rank: Frequent Contributor
timestamp: May 01, 2025, 02:57:30 am
content: For a wearable, I would recommend the MAX31328- its similar to the 3231 in a much smaller package. Package is 5x5 mm 10 pin LGA (chip scale)- easy with hot air. Specs are similar, standby current is 600 nA (vs 300 with 3231).The other viable option is to use an PCF8563 or a DS1302 or DS1307. These are classic old RTC's. The 3231 is a derivative of the 1307 mostly. Don't forget that wearables are "ovenized", they're sitting on your arm at 98.6 degrees and if designed well, will be at a near constant temp. You don't really need all the TC junk that the DS3231 gives you. These were designed for use in Gas meters where there was no access to power for safety and design simplicity (they run on solar or a battery). They sat outside in Norway, etc and needed ridiculously good TC. I'm surprised they became so popular. I think what you buy on the surplus market is floor sweepings and rejects from Gas meter factories, etc. The real parts are kind of pricey like $10 in single units for a good disti.

author: sylvanoMTL
author_rank: Contributor
timestamp: May 01, 2025, 09:13:48 am
content: Sounds like I need to come here to source properly my RTC!Ok, so the project I have in mind is detailed here:https://www.eevblog.com/forum/projects/ntp-server-on-esp32-and-clock-synchronization/msg5899256/#msg5899256It is a telemetry system for rowing boat, where sensors are wireless and need synchronisation between them and the main host. Some of the beacon will be exposed to high level of vibration and impact, as well as temperature differences from -10deg (storage in cold boat bay) to 60deg (exposed to sun).The sensors are likely to be located on oar shafts and the one with a GPS on the boat deckApart from the RTC, I need to see how to synchronize the clocks. my linked post might be too complicated. ideally I want to synchronize all sensors down to 10ms@jwet, I will have a look at the MAX31328.

author: jwet
author_rank: Frequent Contributor
timestamp: May 01, 2025, 01:09:19 pm
content: That's interesting. I made some "CoxBoxes" for my son's impoverished rowing club a decade ago. I found a source for those little aluminum cylinders and they were compatible with the standard models. I also used those goody rubber connectors- fun project. They had an amp and little micro with LCD timer in them.You might want to look at how Network Time Protocol (NTP) works and implement something on a smaller scale. Its clever. My first inclination would be to have GPS in each unit and parse time strings out of them for sync. GPS's unit are so small and cheap these days.

author: DashApple
author_rank: Contributor
timestamp: May 01, 2025, 01:23:40 pm
content: I used the DS3231 for a watch a while back and it does take up some space once you add the backup cell, Its a nice RTC if you need the TC accuracy but its a tad on the large side compared to others.Will definitely look into the MAX31328.

author: jwet
author_rank: Frequent Contributor
timestamp: May 01, 2025, 02:53:02 pm
content: Seiko make some tiny .01F super caps that could hold up an RTC for about and hour for a battery change in a watch.

author: iMo
author_rank: Super Contributor
timestamp: May 01, 2025, 04:10:20 pm
content: DS3231SN/N is the best RTC I ever had. Say <10secs a year or so in ambient conditions, the 3V coin battery lasted for 8years no problem inside an aliexpress module. The package is bulky because it uses a quality crystal (TCXO). Also you may adjust it via internal set of on-chip capacitors. Afaik years back they stopped the production of the SN/N versions and then ADI started again. M version is the cheaper version less accurate, I would avoid it..SN/N still in production:https://www.analog.com/en/products/ds3231.html

author: sylvanoMTL
author_rank: Contributor
timestamp: May 01, 2025, 10:20:48 pm
content: Thanks allThe issue I want to tackle is in the synchronisation of each module. But each module have different functions. And they should be added/removed from the overall system.One function is a shaft power meter. It is subject to shock vibrations, wet environment. And misused (clash, crabs, shock during transportation). It has to be compact has well to avoid increasing drag. (Shaft diameter is 35mm). And I want to keep the design slim and light to reduce inertia.I was thinking of having a master unit with GPS and RTC, and have a NTPserver running on that master. I have done that part with a RPi3 couple of years ago (without GPS) but I was thinking having something lighter and less power hungry, like a esp32

author: sylvanoMTL
author_rank: Contributor
timestamp: May 02, 2025, 02:25:15 pm
content: I am keeping digging the RTC and went on Analog Device to compare the new RTC:https://www.analog.com/en/parametricsearch/12905#/p374=Serial%20I2C&p825=YY-MM-DD/%20HH:MM:SS|YY-MM-DD/%20HH:MM:SS:hh|YYYY-MM-DD/%20HH:MM:SS&ps14=-40%20to%2085%C2%B0C&ps7=Recommended%20for%20New%20DesignsSince all of them have an arduino Library:https://github.com/analogdevicesinc/AnalogRTCLibrary,I will tend to uses one of these. The MAX31328 is available on the PiHut. Unfortunatelly I cannot see any MAX31331 available. Shame as I would have love to investigate the advantage of the SRAM.Seems like the next criteria of selections are:* energy* SRAM* Integrated XTAL* Package size* Temperature compensation <-- Do I really need this If I have a GPS?As someone suggested in my other post, I might use the esp_wifi_get_tsf_time(Wifi_interface) to get the wifi timestamp for synchronisation

author: tooki
author_rank: Super Contributor
timestamp: May 02, 2025, 03:18:28 pm
content: Quote from: jwet on May 01, 2025, 02:57:30 amWell that’s not even remotely true. Core body temperature varies from 97.7–99.5 °F (typical accepted range), but the temperature at the skin varies a lot more. On the torso, it varies from around 92.3–98.4 °F. At the extremities, it will vary even more.Not to mention that people take off their watches.So aside from the fact that human skin is rarely at 98.6°, usually being cooler, it varies way too much to be considered a “near constant” temperature.

author: jwet
author_rank: Frequent Contributor
timestamp: May 02, 2025, 04:41:37 pm
content: Let's get pedantic- this is very constructive. I think there are medications for these kind of disorders these days- you should look into them.I said your arm was 98.6, and a wearable would be relatively constant. (though he's not making a wearable as it turns out)

author: jwet
author_rank: Frequent Contributor
timestamp: May 02, 2025, 05:58:42 pm
content: Quote from: iMo on May 01, 2025, 04:10:20 pmI worked on these parts at Maxim over the years on the applications side. Here's some of the story. Its as much business as technology.The SN/N# has to do with lead finish, ROHS and JESD97 marking- it also affects MSL (moisture level resistance) because the lead free versions had a higher soldering temp requirement that required some parts to be dry packed, etc. The rules changes about the time ADI acquired Maxim and these suffixes could be offered again. Note that these parts are lead frame hybrids and have a crystal in the package that creates other ROHS issues with the compostion of those non semi parts. Its messy. The SN/N# parts shouldn't be different in any end product from the others.]The /M parts use a MEMS resonator rather than a quartz crystal as the frequency reference. These were done for cost reduction mainly but will also eventually allow monolithic construction which will have a lot of benefits. This makes them more rugged with the tradeoff of being slightly less accurate at 5 ppm. They also use a very different compensation method, instead of a semi analog approach that adjusts oscillator load capacitance based on temperature and a table lookup, they use a mostly digital approach that adds and subtracts small corrections into the divider chain in the digital domain. This is why you can't have a high frequency output on the Square Wave Output- only the divided down output. The standard parts work more like a TCXO with a corrected oscillator feeding a straight chain of counters and RTC logic. The /M part are digitally compensated and the 1 Hz output is accurate but upstream corrections are made and intermediate counts aren't available.These parts were developed for gas meter customers that had a very specific need and were pretty pricey. Maxim was very surprised at how popular they were. Standard quartz clocks are very accurate over narrow temp spans but a lot of embedded developers liked them because time syncing was complicated at the system level- having very accurate time eased their burdens. The other parts like the /M and 38128 were developed for these follow on apps. This is how Maxim goes to market generally.Since these parts were invented, there are a lot of similar compensated RTC's that have come out- they cover quite a large range. The remote metering application is a large market and there are other markets but I think the there are more solutions than the market requires and you are seeing an erosion in pricing- good for hobbyists and some manufacturers but bad for the original developer. This is the point in the design life curve that Maxim will exit and let others fight for crumbs following margins to zero. The profitable part of the life cycle is the early ramp to maturity where you are selling high volumes of high margin parts. On an ROI basis, chasing medium volumes with lots of competitors for diminishing share and margins is not very profitable and isn't where Maxim wants to be. Its a bit counter intuitive that selling a part where you have sunk your development costs for any margin available would be good- its not.

author: Peabody
author_rank: Super Contributor
timestamp: May 02, 2025, 08:54:14 pm
content: It's been my assumption that most of the SN and M modules that we order from the Far East contain counterfeit chips, because the cost of the module is usually well below what Digikey wants for just the chip. But I could be wrong. The ones I've received, including the ones marked SN that actually behave like SNs, seem to work fine. Of course the ones marked SN that behave like Ms are fakes.One difference I have found is that the SNs appear to be pretty much on the money with the aging register set to zero, but the Ms are way off. I have a setup that sets the aging register to the number that most closely matches the PPS output of a GPS module. The SNs I have are within +/-5, but a typical M would need a +40 or more aging setting to keep good time.@jwet, can you confirm that on the M the 32K output is the raw MEMS output, without any aging or temperature corrections applied?

author: tooki
author_rank: Super Contributor
timestamp: May 02, 2025, 11:42:02 pm
content: Quote from: jwet on May 02, 2025, 04:41:37 pmAnd again you’d be wrong. This isn’t a disorder, the ranges listed are the normal variation for a healthy human. Our body temperatures are NOT constant, they vary.

author: jwet
author_rank: Frequent Contributor
timestamp: May 03, 2025, 12:02:20 am
content: Quote from: Peabody on May 02, 2025, 08:54:14 pmOn counterfeits, I don't know really. These things are bought in large quantities and there are a lot broken or partial reels, feeder jam-ups and spills , etc that create less than prime parts that are sold gray market. I think most of the Shenzen parts are these. All parts of any value today are counterfeited at some level.On your second point- yes- the 32k on the M part is the raw oscillator out. You'll note that this has a tolerance of 2.5 percent, only the 1 pps has the 1 ppm tolerance. The corrections for the M parts are made during the dividing digitally. Its divulged in a patent somewhere- I might have been a co-inventor. The regular 3231 32k out is also at the oscillator but the oscillator is compensated with caps so the 32k is right on.There are some new things coming in RTC's that you can read about in the literature. They use some kind of quantum effect that I can't say I understand. They should give rubidium kind of accuracy at currents like one of the RTC's. I'm sure my friends at ADI are up to speed on them- they're still in the university labs.