NVRAM of DS3231 real time clock board UPDATE

I previously posted about having problems with the AZ Delivery DS3231. I've bought a different version (NOT AZ Delivery). This version (MH?) works fine and has 4KBytes of non volatile RAM.

(As an aside I notice they have (correctly) not installed the charging diode.)

Here is how I tested the full extent of the NVRAM (there was some doubt about whether it was a 32KByte or 32KBit).

#include <AT24Cxx.h> // For the Non Volatile RAM
 
static int ikNVRAMAddress = 0x57 ; 

// NVRAM on the DS3231 module
AT24Cxx NvRam (0x57) ;

void setup () {
    Serial.begin(9600);
}


// Make a test val with contains parts of high and low bytes of the address
uint8_t GetTestVal (int iAddr)
{
    uint8_t iTopTestBit = (iAddr & 0x01) << 7 ;
    uint8_t iLowerBits = (iAddr >> 8) ;
    
    return (iTopTestBit | iLowerBits) & 0xFF ;
}

void loop () {
    // "Fill" the NVRAM with data

    // Use just one of these lines. 
    const int ikBytesToTest = 4096 ;
    // const int ikBytesToTest = 5000 ; // This gives errors, 
    
    for (int iAddr = 0 ; iAddr < ikBytesToTest ; ++iAddr) {
        int iTestVal = GetTestVal(iAddr) ;
        NvRam.write(iAddr,iTestVal); 
    }

    // Check that at each address we get what we expected, what was written in the previous loop
    for (int iAddr = 0 ; iAddr < ikBytesToTest ; ++iAddr) {
      const int ikVal = NvRam.read(iAddr);
      Serial.print("at address:");
      Serial.print(iAddr);
      Serial.print(" read:");
      Serial.print(ikVal);  

      // This is what we should see at that address...
      int iTestVal = GetTestVal(iAddr) ;

      if (ikVal  == iTestVal) {
          Serial.println(" OK") ;
          
      } else {
          Serial.print(" ***ERROR*** should be ") ;
          Serial.println(iTestVal) ;
          delay(5000); 
      }
    }
}

All values are written and read fine assuming 4096 Bytes, and there are errors going beyond that (5000 bytes). Presumably address beyond 4095 are truncated and wrapped around to the start of the RAM.

Are you sure? I thought these modules had EEPROM or Flash memory, not NVRAM.

The important difference is that EEPROM/Flash has limited write cycles

What part number can you read on the memory chip?

I can't it's too small... and I'm too old.

But you are right, it is an EEPROM according to the product page.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.