Hello everyone, I need some help with this one, Flash memory is something completely new for me and I'm having trouble figuring out how to achieve a simple read and write to this adesto flash chip. I've been able to figure out how to get the device id, but thats as far as i can understand. I am using and arduino due, and just simple SPI.transfer. I just need to read and write to 2 bytes. I do need to learn how to do this for a separate in an fpga, using arduino is the simplest to start with having the serial console.
heres the device ID read.
this returns 1F, 27, 01,01, 0.
#include <SPI.h>
#define SERIAL_BAUD 9600
#define MEMORY 4 // Chip select pin
void setup()
{
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
Serial.begin(SERIAL_BAUD);
Serial.println("Starting");
SPI.begin(MEMORY);
SPI.setClockDivider(MEMORY, 21);
SPI.setDataMode(MEMORY, SPI_MODE0);
// Get manufacturer id
SPI.transfer(MEMORY, 9F, SPI_CONTINUE);
byte response1 = SPI.transfer(MEMORY, 0x00, SPI_CONTINUE);
byte response2 = SPI.transfer(MEMORY, 0x00, SPI_CONTINUE);
byte response3 = SPI.transfer(MEMORY, 0x00, SPI_CONTINUE);
byte response4 = SPI.transfer(MEMORY, 0x00, SPI_CONTINUE);
byte response5 = SPI.transfer(MEMORY, 0x00);
Serial.print("Manufacturer ID: ");
Serial.println(response1,HEX);
Serial.print(", ");
Serial.println(response2,HEX);
Serial.print(", ");
Serial.println(response3,HEX);
Serial.print(", ");
Serial.println(response4,HEX);
Serial.print(", ");
Serial.println(response5,HEX);
}
void loop()
{
}