Erase all from I2C FRAM?

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
littleninja
 
Posts: 63
Joined: Fri Oct 19, 2018 2:36 pm

Erase all from I2C FRAM?

Post by littleninja »

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?

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

Re: Erase all from I2C FRAM?

Post by jacro »

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

Code: Select all

#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);
  }
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”