lpcware

LPC1788 with SRAM Problem??

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by AkshayHV on Thu Jan 22 06:03:39 MST 2015
Hello

I am using a LPC 1788 controller with SRAM W241024A 128K * 8 for storing data. The problem that i am facing is whenever i write data into my SRAM and try to read the data the data i get is the last byte of the previously written data.for example if i write"ABCDEFGH" into the SRAM the I try to read the same data from SRAM I am getting "HHHHHHHH".the initialization function is as below and I am using WE pin as GPIO and controlling it manually while reading and writing.

  void SRAMInit( void )
{
volatile uint32_t i;
volatile unsigned long Dummy;
#if 1
//data lines//
LPC_IOCON->P3_0 = 0x21;
LPC_IOCON->P3_1 = 0x21;
LPC_IOCON->P3_2 = 0x21;
LPC_IOCON->P3_3 = 0x21;
LPC_IOCON->P3_4 = 0x21;
LPC_IOCON->P3_5 = 0x21;
LPC_IOCON->P3_6 = 0x21;
LPC_IOCON->P3_7 = 0x21;
#else
//data lines//
LPC_IOCON->P3_16 = 0x21;
LPC_IOCON->P3_17= 0x21;
LPC_IOCON->P3_18 = 0x21;
LPC_IOCON->P3_19= 0x21;
LPC_IOCON->P3_20= 0x21;
LPC_IOCON->P3_21= 0x21;
LPC_IOCON->P3_22= 0x21;
LPC_IOCON->P3_23= 0x21;
#endif
//address lines//
LPC_IOCON->P4_0 = 0x21;
LPC_IOCON->P4_1 = 0x21;
LPC_IOCON->P4_2 = 0x21;
LPC_IOCON->P4_3 = 0x21;
LPC_IOCON->P4_4 = 0x21;
LPC_IOCON->P4_5 = 0x21;
LPC_IOCON->P4_6 = 0x21;
LPC_IOCON->P4_7 = 0x21;
LPC_IOCON->P4_8 = 0x21;
LPC_IOCON->P4_9 = 0x21;
LPC_IOCON->P4_10 = 0x21;
LPC_IOCON->P4_11 = 0x21;
LPC_IOCON->P4_12 = 0x21;
LPC_IOCON->P4_13 = 0x21;
LPC_IOCON->P4_14 = 0x21;
LPC_IOCON->P4_15 = 0x21;
LPC_IOCON->P5_0 = 0x21;

LPC_IOCON->P4_24 = 0x21;
//LPC_IOCON->P4_25 = 0x21;

LPC_IOCON->P4_31 = 0x00;
LPC_GPIO4->DIR |= (1<<31);
LPC_GPIO4->SET |= (1<<31);
LPC_IOCON->P4_30 = 0x21;

LPC_SC->PCONP   |= 0x00000800;
LPC_SC->EMCDLYCTL |= (8<<0);
LPC_SC->EMCDLYCTL |=(8<<8);

LPC_SC->EMCDLYCTL |= (8<<16);
LPC_EMC->Config = 0x80;
LPC_EMC->StaticExtendedWait = 0x00;
LPC_EMC->StaticConfig0 = 0x80;
LPC_EMC->StaticWaitWen0 = 0x01;
LPC_EMC->StaticWaitOen0 = 0x01;
LPC_EMC->StaticWaitRd0 = 0x01;
LPC_EMC->StaticWaitWr0 = 0x01;
LPC_EMC->Control = 0x01;

}


Thanks in advance for any help


regards
Akshay H V

Outcomes