Hello people,
I am using a AT25 family eeprom with Arduino nano, it works fine if i follow the tutorial but in this code i i replace register API's with SPI.h library then the eeprom doesn't respond.
Here is the example of small modification i have done to this code.
byte read_eeprom(int EEPROM_address)
{
//READ EEPROM
int data;
digitalWrite(SLAVESELECT,LOW);
spi_transfer(READ); //transmit read opcode
spi_transfer((char)(EEPROM_address>>8)); //send MSByte address first
spi_transfer((char)(EEPROM_address)); //send LSByte address
data = spi_transfer(0xFF); //get data byte
digitalWrite(SLAVESELECT,HIGH); //release chip, signal end transfer
return data;
}
I have changed above part of the code to
byte read_eeprom(int EEPROM_address)
{
//READ EEPROM
int data;
digitalWrite(SLAVESELECT,LOW);
SPI.transfer(READ); //transmit read opcode
SPI.transfer((char)(EEPROM_address>>8)); //send MSByte address first
SPI.transfer((char)(EEPROM_address)); //send LSByte address
data = SPI.transfer(0xFF); //get data byte
digitalWrite(SLAVESELECT,HIGH); //release chip, signal end transfer
return data;
}
Done this everywhere in the code.
I have also tried the following spi settings
- Tried different clock dividers, div8,div16,div32,div64
- Tried using different MAX Speed in
SPISETTINGS settings (speed, msb/lsb first, mode) - I have also tried changing the mode to mode3 from mode 0.
Please help me solve this issue.
Regards,
Mayur