I'm trying to communicate through SPI to a Flash ROM chip (M45PE20) with an ATMEGA 2560. I'm looking to read the data off the chip, but the output I'm getting is nothing but FF's. I've checked my wiring and everything looks okay on that end, I also don't have a scope to probe the output unfortunately.
I've the crude code below:
void setup() {
Serial.begin(9600);
pinMode(SS, OUTPUT);
digitalWrite(SS, HIGH);
SPI.begin();
}
void loop() {
Serial.println("Starting");
Serial.println("Waiting 1s");
delay(1000);
SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0));
digitalWrite(SS, LOW);
Serial.println(SPI.transfer(0x03));
Serial.println(SPI.transfer(0x00));
Serial.println(SPI.transfer(0x00));
Serial.println(SPI.transfer(0x00));
for (int i = 0; i < 16384; i++) {
Serial.print(i * 32, HEX);
Serial.print(" ");
for (int j = 0; j < 32; j++) {
Serial.print(SPI.transfer(0xFF), HEX);
Serial.print(" ");
}
Serial.println();
}
Serial.println();
digitalWrite(SS, HIGH);
delay(500);
SPI.endTransaction();
delay(5000);
}
Link to datasheet: https://drive.google.com/file/d/1_Zlg-hb5B08u7_m_N4_addmmjyv_nANS/view?usp=sharing
Picture of specific read command from datasheet: