0

Erase all from I2C FRAM?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Erase all from I2C FRAM?

by littleninja on Fri Oct 19, 2018 3:11 pm

I need to erase everything from my Adafruit I2C FRAM breakout board but I'm not entirely sure how to, and I can't seem to find anything that helps online at all. Does anyone have any pointers?

littleninja
 
Posts: 22
Joined: Fri Oct 19, 2018 2:36 pm

Re: Erase all from I2C FRAM?

by jacro on Sat Dec 01, 2018 5:35 pm

You just need to cycle through the memory and reset each byte...

Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include "Adafruit_FRAM_I2C.h"

/* Example code for the Adafruit I2C FRAM breakout */

/* Connect SCL    to analog 5
   Connect SDA    to analog 4
   Connect VDD    to 5.0V DC
   Connect GROUND to common ground */
   
Adafruit_FRAM_I2C fram     = Adafruit_FRAM_I2C();
uint16_t          framAddr = 0;

void setup(void) {
  Serial.begin(9600);
 
  while (!Serial)
    delay(100);

  if (fram.begin()) {  // you can stick the new i2c addr in here, e.g. begin(0x51);
    Serial.println("Found I2C FRAM");
  } else {
    Serial.println("No I2C FRAM found ... check your connections\r\n");
    while (1);
  }
 
  // Iterate through memory and reset each value...
  for (uint16_t a = 0; a < 32768; a++) {
    fram.write8(a, 0);
  }
}

jacro
 
Posts: 2
Joined: Sun Sep 23, 2018 8:18 am

Please be positive and constructive with your questions and comments.