Quick Start¶
Who this is for¶
If you are new to Arduino external memory chips, start here.
For a step-by-step first session, use First Hour Setup.
1. Install the library¶
Arduino Library Manager¶
- Open Arduino IDE.
- Go to Sketch > Include Library > Manage Libraries.
- Search for SPIMemory.
- Install latest version.
ZIP install¶
- Download repository ZIP.
- Rename extracted folder to
SPIMemory. - Move it to your Arduino libraries folder.
2. Wire the chip¶
Connect at minimum:
SCKMISOMOSICS(chip select)VCCGND
For flash chips, ensure HOLD and WP pins are pulled to valid logic levels as required by datasheet.
3. First flash sketch¶
#include <SPIMemory.h>
SPIFlash flash(10); // CS pin
void setup() {
Serial.begin(115200);
if (!flash.begin()) {
Serial.print("begin failed, err=0x");
Serial.println(flash.error(), HEX);
return;
}
uint32_t addr = 0;
flash.eraseSector(addr);
flash.writeULong(addr, 123456789UL);
uint32_t out = flash.readULong(addr);
Serial.print("Read: ");
Serial.println(out);
}
void loop() {}
4. Validate using bundled examples¶
Recommended beginner order:
examples/FlashDiagnostics/FlashDiagnostics.inoexamples/readWriteString/readWriteString.inoexamples/getAddressEx/getAddressEx.inoexamples/Struct_writer/Struct_writer.ino
Use Example Sketches Guide for a full breakdown of what each sketch tests, what success looks like, and how to use failures for troubleshooting.
5. If it fails¶
- Call
flash.error(VERBOSE). - Check Errors and Diagnostics.
- Run diagnostics example and capture output.
- Follow the troubleshooting workflow in Example Sketches Guide.