The Adafruit SPI FRAM is a non-volatile memory module that utilizes ferroelectric random access memory (FRAM) technology. This component is designed for applications requiring high-speed data writing, low power consumption, and the ability to retain data without power. It is ideal for use in data logging, real-time clocks, and other scenarios where data must be preserved across power cycles.
Pin Number | Name | Description |
---|---|---|
1 | CS | Chip Select, active low |
2 | MISO | Master In Slave Out, SPI data output |
3 | WP | Write Protect, active low |
4 | VSS | Ground |
5 | MOSI | Master Out Slave In, SPI data input |
6 | SCK | Serial Clock, SPI clock input |
7 | HOLD | Suspends serial communication without resetting the serial sequence |
8 | VCC | Supply Voltage |
#include <SPI.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);
// Initialize SPI
SPI.begin();
// Initialize the FRAM module
if (fram.begin()) {
Serial.println("Found SPI FRAM");
} else {
Serial.println("No SPI FRAM found ... check your connections");
}
// Write data to FRAM
uint8_t dataToWrite = 42; // Example data
fram.writeEnable(true);
fram.write8(0, dataToWrite);
fram.writeEnable(false);
// Read data from FRAM
uint8_t readData = fram.read8(0);
Serial.print("Data read from FRAM: ");
Serial.println(readData);
}
void loop() {
// Code to interact with FRAM can be placed here
}
Q: How long will the FRAM retain data? A: The FRAM is rated to retain data for over 10 years without power.
Q: Can I use the Adafruit SPI FRAM with a 5V microcontroller? A: Yes, the Adafruit SPI FRAM can operate with a supply voltage of up to 5V.
Q: How many write cycles can the FRAM handle? A: The FRAM can handle up to 10^14 write cycles, making it highly durable for write-intensive applications.
Q: Is it necessary to use the HOLD pin? A: The HOLD pin is optional and is used to pause communication without resetting the SPI connection. If not used, it should be tied to VCC.