The Adafruit SPI Non-Volatile FRAM 8KB is a high-performance, ferroelectric random access memory (FRAM) module that provides robust, non-volatile data storage. Unlike traditional non-volatile memories like EEPROM or Flash, FRAM offers faster write speeds and a much higher endurance for write cycles. This makes it ideal for applications that require frequent or rapid data logging or updates, such as wear-leveling tasks, data caching, and real-time data collection. The module communicates with microcontrollers via the Serial Peripheral Interface (SPI) protocol.
Pin Number | Name | Description |
---|---|---|
1 | CS | Chip Select, active low |
2 | DI | Data In, SPI MOSI (Master Out Slave In) |
3 | DO | Data Out, SPI MISO (Master In Slave Out) |
4 | SCK | Serial Clock, SPI Clock |
5 | Vcc | Power supply (3.3V to 5V) |
6 | GND | Ground |
Powering the FRAM: Connect the Vcc pin to a 3.3V or 5V power supply, and the GND pin to the ground.
SPI Communication: Connect the CS, DI, DO, and SCK pins to the corresponding SPI pins on your microcontroller. For Arduino UNO, the connections are typically as follows:
Library Installation: Install the Adafruit FRAM SPI library via the Arduino Library Manager or download it from the Adafruit GitHub repository.
Initialization: In your code, initialize the FRAM module using the library's functions. Check for successful initialization before proceeding with read/write operations.
#include <Wire.h>
#include <Adafruit_FRAM_SPI.h>
// Pin definitions
#define CS_PIN 10
// Create an FRAM_SPI instance
Adafruit_FRAM_SPI fram = Adafruit_FRAM_SPI(CS_PIN);
void setup() {
Serial.begin(9600);
while (!Serial) {
; // Wait for serial port to connect
}
// Initialize SPI FRAM
if (fram.begin()) {
Serial.println("Found SPI FRAM");
} else {
Serial.println("No SPI FRAM found ... check your connections");
while (1);
}
// Write example data to FRAM
uint8_t testdata = 42;
fram.writeEnable(true);
fram.write8(0, testdata);
fram.writeEnable(false);
// Read back the data
uint8_t result = fram.read8(0);
Serial.print("Read: 0x"); Serial.println(result, HEX);
}
void loop() {
// Nothing to do here
}
Q: Can I use this FRAM with a 5V microcontroller? A: Yes, the Adafruit SPI Non-Volatile FRAM 8KB is 5V tolerant on the SPI pins.
Q: How many write cycles can the FRAM handle? A: The FRAM can handle up to 10^14 write cycles, which is significantly higher than EEPROM or Flash.
Q: Do I need to perform any special operations before powering down the system? A: No, FRAM retains data without any special power-down sequence.
Q: Is it possible to use multiple FRAM modules on the same SPI bus? A: Yes, you can use multiple FRAM modules on the same SPI bus by assigning different CS pins for each module.