2

I'm looking for an RTC to use with my Pi and came across the Maxim DS3231M. I also saw a similar model on Maxim's website, the DS3232M, which comes with 236 bytes of SRAM. The DS3231 seems to be a relatively popular choice for the Pi (the only difference between it and the -M version being the -M's MEMS oscillator instead of a regular crystal), but I can't find anything on people using the DS3232M.

What is this memory for?

  • the allowable supply voltage range is probably the reason for choice – jsotola Jan 5 at 23:14
  • what do you mean? I can't find anything on people using the DS3232M – jsotola Jan 5 at 23:14
  • @jsotola I can't find any web pages, Stack exchange questions, blog posts, etc. about people using the DS3232M with a Raspberry Pi. The supply voltage range does seem like a good reason most people would go with the 3231; having a more complex circuit for a little extra memory isn't worth it on a Pi. I just didn't know if it was for saving the time if the battery backup failed or some other clock-related function. – zaen Jan 5 at 23:19
  • i am not sure what you mean by more complex circuit .... the two devices use the same connections to the microcontroller ..... why don't you research RPi with external nvram, maybe something will show up – jsotola Jan 5 at 23:36
  • @jsotola I wasn't aware that there were 3.3V pins on the Raspberry Pi, I thought they were all 5V and you would have to use a voltage divider or something similar to get it below the 4.5V maximum on the 3232. What were you talking about in your first comment? – zaen Jan 6 at 0:18
4

@Dougie is absolutely correct, you can to whatever you want with this memory, and it will survive a power cut of the main supply as long as the battery is OK.

The reason for such memory is that in microcontroller projects, there's often the need to store some data so that it survives a power cut. Many microcontrollers have builtin EEPROM, but EEPROM can only be written a limited number of times (order of 100.000 times). So, writing to EEPROM whenever the data changes might be a bad idea. Writing only in the event of a power cut might be OK, but adds complexity to detect and react to it. The microcontroller supply voltage must sustain long enough to write the data to EEPROM, and since EEPROM writes are quite slow, this needs big buffer capacitors.

RTCs are ultra low power devices, which are supplied from an external power supply, but switch to the battery on a power cut. They already have a serial interface, so adding some SRAM, which also needs almost no power to keep the data is a good idea. So, that's why you often find some RAM in RTCs.

2

The non-volatile RAM (while the battery backup is OK) is there for whatever purpose you like. It's not secure storage, it's easily overwritten (by a root user) but it's just a spare few bytes which you can write and read any time you like. It will persist across a power cycle, boot or reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.