Author Topic: Why is there an EEPROM on RTC Modules?  (Read 8168 times)

0 Members and 1 Guest are viewing this topic.

Offline Thane of CawdorTopic starter

  • Regular Contributor
  • *
  • Posts: 96
Why is there an EEPROM on RTC Modules?
« on: March 22, 2017, 05:29:42 am »
Hey all,

Is the EEPROM (AT24C32) on cheap RTC modules used to store date/time values if the RTC loses power or is there some other purpose for this? Here's an example of one of these modules: http://www.dx.com/p/ds3231-high-precision-real-time-clock-module-blue-3-3-5-5v-222910

 :D
 

Online forrestc

  • Supporter
  • ****
  • Posts: 708
  • Country: us
Re: Why is there an EEPROM on RTC Modules?
« Reply #1 on: March 22, 2017, 05:55:48 am »
I suspect it is to make data logging more convenient.

Because the EEPROM can be written and erased on a per-byte basis, it makes since to log values to it until it is full, then you can copy it's contents to a SD card or wherever the data is going long term.   

There isn't any special between the EEPROM and the RTC that I can see or know of other than someone somewhere decided that having both on a little breakout board was a good idea.


 

Offline helius

  • Super Contributor
  • ***
  • Posts: 3680
  • Country: us
Re: Why is there an EEPROM on RTC Modules?
« Reply #2 on: March 22, 2017, 06:02:07 am »
Time-Of-Day / Clock-Calendar chips for computers commonly include NVRAM, because both functions require battery backup and it is convenient to share a single battery. The design of clock modules with non-volatile storage (like EEPROM) may be based on that usage, especially if they use the same interface.
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4321
  • Country: us
  • KJ7YLK
Re: Why is there an EEPROM on RTC Modules?
« Reply #3 on: March 22, 2017, 06:05:33 am »
A common use-case is for the application code to write the time into the NVRAM every few seconds or minutes (or whatever is appropriate).  So that if the system loses power, the application can check the current time vs. the last recorded time-stamp to see how long it has been down and take appropriate action.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 13132
Re: Why is there an EEPROM on RTC Modules?
« Reply #4 on: March 22, 2017, 08:02:07 am »
To a large extent its just crazy.  I'm sure there are a few applications that can benefit from it, but if you log to EEPROM, with the AT24C32's 1M write page endurance, logging one byte per second, using the full memory (so the wear is even),  you can wear it out in under seven weeks!   Memory on a RTC module that's actually going to be used as a logging buffer needs to have unlimited write endurance (i.e, RAM or FRAM).  You also want lots of it to minimise the number of writes to SD card or other FLASH.
 

Online Nusa

  • Super Contributor
  • ***
  • Posts: 2417
  • Country: us
Re: Why is there an EEPROM on RTC Modules?
« Reply #5 on: March 22, 2017, 08:33:19 am »
I think you're just looking at a two-fer module. You've got two I2C devices with different addresses on the same board. They're both slaves, so they can't talk to each other directly. It's up to the master to make use of them. Do an I2C port scan and see if they both show up.

Using the magic of datasheets:
DS3221 seems to have a fixed address of 0x68.
AT24C32 has a configurable address of 0x50 - 0x58 (the A0,A1,A2 solder jumpers)
 

Offline Thane of CawdorTopic starter

  • Regular Contributor
  • *
  • Posts: 96
Re: Why is there an EEPROM on RTC Modules?
« Reply #6 on: March 22, 2017, 09:10:23 am »
A common use-case is for the application code to write the time into the NVRAM every few seconds or minutes (or whatever is appropriate).  So that if the system loses power, the application can check the current time vs. the last recorded time-stamp to see how long it has been down and take appropriate action.

Hmm I see, so by the 'system' you're referring to the microcontroller section only right (as in the RTC is still being powered by the CR2032 backup battery and thus timekeeping correctly)?

 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4321
  • Country: us
  • KJ7YLK
Re: Why is there an EEPROM on RTC Modules?
« Reply #7 on: March 22, 2017, 04:19:47 pm »
Hmm I see, so by the 'system' you're referring to the microcontroller section only right (as in the RTC is still being powered by the CR2032 backup battery and thus timekeeping correctly)?
Yes.  The complete larger system typically takes orders of magnitude more power to operate than can be provided by a small coin cell. So only the critical parts (real-time timekeeping, and certain variables) are stored in the NVRAM.
 
The following users thanked this post: Thane of Cawdor

Offline tecman

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: us
Re: Why is there an EEPROM on RTC Modules?
« Reply #8 on: March 22, 2017, 06:32:07 pm »
A common use-case is for the application code to write the time into the NVRAM every few seconds or minutes (or whatever is appropriate).  So that if the system loses power, the application can check the current time vs. the last recorded time-stamp to see how long it has been down and take appropriate action.

Be careful.  EEPROMs have a finite number of write/erase cycles available.  Writing every several seconds would result in a short life for the EEPROM.  For the Atmel chip referenced, writing every 3 seconds would hit the life limit in 33 days.  Typically EEPROMs are included on the same I2C bus as a convenience.

paul


 
The following users thanked this post: Thane of Cawdor

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9936
  • Country: us
Re: Why is there an EEPROM on RTC Modules?
« Reply #9 on: March 22, 2017, 07:45:43 pm »
In the bad old days, program code was stored in EPROM (or OTP ROM) so there was no place to store things like calibration constants or any other field derived data.  Wouldn't it be nice to have just a few bytes to store some things on a more or less permanent basis?  Enter the RTC chip with a small slice of non-volatile memory (battery backed).

Even modern uCs often have a small piece of EEPROM in addition to the fact that programs are stored in flash and data can be stored to flash under some conditions.

https://electrosome.com/internal-eeprom-pic-microcontroller/

Some uCs include code protection so the program can't write to flash memory after protection is enabled and the only place to store data is in the EEPROM.  This is usually fairly small, on the order of 256 bytes or so.
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4321
  • Country: us
  • KJ7YLK
Re: Why is there an EEPROM on RTC Modules?
« Reply #10 on: March 22, 2017, 08:30:44 pm »
Be careful.  EEPROMs have a finite number of write/erase cycles available.
Right. Which is why the memory is battery-backed NVRAM, NOT EEPROM.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf