Ing. Tam HANNA
Published © Apache-2.0

SeeedStudio Grove Module with GD25 flash memory

Use a GigaDevice GD25Q16 flash memory chip to add remanent storage to an Arduino Due or another process computer

BeginnerFull instructions provided4 hours246
SeeedStudio Grove Module with GD25 flash memory

Things used in this project

Hardware components

Arduino Due
Arduino Due
×1
GD25Q16
GigaDevice GD25Q16
×1

Software apps and online services

Arduino IDE
Arduino IDE
Target 3001
Marzogh’s SPIMemory library

Hand tools and fabrication machines

Seeed Studio Fusion PCB/PCBA
Seeed Studio Fusion PCB/PCBA

Story

Read more

Schematics

tammodulagira2_RbtG0ikp5N.T3001

2_z08aelXrdy.png

Code

sketch_gdflash.ino

Arduino
#include<SPIMemory.h>

SPIFlash myIF(2);

bool getID() {
  uint32_t JEDEC = myIF.getJEDECID();
  if (!JEDEC) {
    Serial.println("No comms. Check wiring. Is chip supported? If unable to fix, raise an issue on Github");
    return false;
  }
  else {
    Serial.print("JEDEC ID: 0x");
    Serial.println(JEDEC, HEX);
    Serial.print("Man ID: 0x");
    Serial.println(uint8_t(JEDEC >> 16), HEX);
    Serial.print("Memory ID: 0x");
    Serial.println(uint8_t(JEDEC >> 8), HEX);
    Serial.print("Capacity: ");
    Serial.println(myIF.getCapacity());
    Serial.print("Max Pages: ");
    Serial.println(myIF.getMaxPage());
    }
  return true;
}

void charTest() {
  uint32_t addr;
  int8_t _data, _d;
  _d = -255;

  addr = random(0, 0xFFFFF);

 Serial.print ("Char test write ");
 myIF.eraseSector(addr);
  Serial.println( myIF.writeChar(addr, _d, true));
  delay(100);

Serial.println(myIF.error(true));
 Serial.println ("Char test write done");
  _data = myIF.readChar(addr);

  Serial.print ("Char test did");
  if (_data == _d) {
     Serial.println ("PASS");
  }
  else {
     Serial.println ("FAIL");
  }

}

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

  Serial.println("entering ");
  myIF.begin(MB(16));
  Serial.println("sniffing");
  getID();
  
  charTest();

  

}

void loop() {
  // put your main code here, to run repeatedly:

}

Marzogh SPI Library

Credits

Ing. Tam HANNA
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.