I'm having issues reading information from a A25L080-F flash memory IC. The issue isn't that i'm not reading anything from the IC, but rather that it's not supplying any correct data.
The relevant code that i'm using to retrieve the device identification data is:
#include <SPI.h>
const int ss = 10;
#define WB_DEVICE_ID 0x9f
void readDeviceIdentification() {
digitalWrite(ss, HIGH); //in case the select was still low
digitalWrite(ss, LOW);
SPI.transfer(WB_DEVICE_ID);
Serial.print("Read result: 0x");
int result = SPI.transfer(0x00);
Serial.println(result, HEX);
Serial.print("Read result: 0x");
result = SPI.transfer(0x00);
Serial.println(result, HEX);
Serial.print("Read result: 0x");
result = SPI.transfer(0x00);
Serial.println(result, HEX);
Serial.print("Read result: 0x");
result = SPI.transfer(0x00);
Serial.println(result, HEX);
Serial.print("Read result: 0x");
result = SPI.transfer(0x00);
Serial.println(result, HEX);
digitalWrite(ss, HIGH);
}
void setup() {
pinMode(ss, OUTPUT);
SPI.begin(); // wake up the SPI bus.
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
Serial.begin(31250);
}
void loop() {
readDeviceIdentification();
delay(999999);
}
According to the datasheet, using the read ID command the output I should be reading:
0x37 0x30 0x14 (0x00 0x00)
The two 0x00 at the end are what I assume are going to be read
But when I run that code, I read:
0x2C 0x80 0x05 0x90 0x00
I've tried multiple ways of trying to fix this; changing the SPI data mode and speed do nothing, adding a pull-up/down resistor on the MISO line either does nothing or produces either 0x00 and 0xFF only, and I've exchanged the IC with another one I bought.
For more information on the circuit, i'm using resistor voltage dividers for the CS, MOSI and SCK lines to 3.3v as I'm still waiting on a hex buffer to arrive in the mail, and multiple sources say that I don't need to step up the MISO from 3.3v to 5v so I've left it as a direct connection from the IC to the MISO pin.
I really would appreciate any help with this as I've attempted for a couple of days now trying to fix it with no luck.