Hi,
I wish to interface at45db081d-ssu-2.5(serial EEPROM with SPI) with an ARM processor. I would like some tips to use EEPROM.
The procedure I follow is : ->SPI enable ->Erase chip ->write ->read
But when i read the data i get garbage .I think there is some trouble in reading or writing.Can i get a pseudo code for any SPI EEPROM device.
Sample code i am referring :
// AT45DB081D - Buffer Write _spi_start(); _spi_sendbyte(0x87); // Command - Write Buffer 2 // long data type _spi_sendbyte(0x00); // Address - x x x x x x x x _spi_sendbyte(0x00); // Address - x x x x x x x B _spi_sendbyte(0x0E); // Address - B B B B B B B B _spi_sendbyte(0x00); // ??? 1 Dummy Byte ??? _spi_sendbyte(0x12); // ?????? ???? _spi_sendbyte(0x23); // ?????? ???? _spi_sendbyte(0x34); // ?????? ???? _spi_sendbyte(0x45); // ????????? ???? _spi_sendbyte(0x56); // ????? ???? _spi_stop();
// AT45DB081D - Buffer Read // (D1H for buffer 1 or D2H for buffer 2) _spi_start(); _spi_sendbyte(0xD1); // Command - Read Buffer 1 _spi_sendbyte(0x00); // Address - x x x x x x x x _spi_sendbyte(0x00); // Address - x x x x x x x B _spi_sendbyte(0x0E); // Address - B B B B B B B B _spi_sendbyte(0x00); // 1 Dummy Byte MEMbuff[0] = _spi_readbyte(); // ?????? ???? MEMbuff[1] = _spi_readbyte(); // ?????? ???? MEMbuff[2] = _spi_readbyte(); // ?????? ???? MEMbuff[3] = _spi_readbyte(); // ????????? ???? MEMbuff[4] = _spi_readbyte(); // ????? ???? _spi_stop();