lpcware

SPI EEPROM using SSP ( LPC1768, lpcxpresso)

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by richas on Fri Nov 15 13:44:01 MST 2013
Hi All,
    I am having some issue with an AT25040 SPI EEPROM using the SSP interface.

I am writing 0xAA to location 0.  I read it using this code: 

volatile uint8_t testVal = 0;

LPC_GPIO1->FIOCLR |= (1 << 22);//assert CE
LPC_SSP0->DR = (((0x08) & adr) | 0x03);
while ((LPC_SSP0->SR & 0x10) == 0x10);
LPC_SSP0->DR = adr;
while ((LPC_SSP0->SR & 0x10) == 0x10);
LPC_SSP0->DR = 0x00;
while ((LPC_SSP0->SR & 0x10) == 0x10);   //LPCxpresso register watch show 0XAA in the DR here  (Mouse over of the DR shows zero!)
testVal = LPC_SSP0->DR;
while ((LPC_SSP0->SR & 0x10) == 0x10);
LPC_GPIO1->FIOSET |= (1 << 22);//deassert CE

return(testVal);


As I step through it, watching the SSP registers in LPCxpresso, I see the DR get loaded with 0xAA as descibed in the comment in the code.  Mouse over shows zero.  TestVAl gets loaded with 0.

Ideas?

Rich

Outcomes