AnsweredAssumed Answered

SRAM Interface With LPC4367

Question asked by Gaurav More on Aug 19, 2019
Latest reply on Sep 1, 2019 by soledad

I am using LPC4367 for my product development. I refered the code for EMC interface. But after interfacing code the and debugging i am facing follwing issue when I interfaced SRAM (IS64WV12816DBLL).

When I write the data then it shows the data is written in it after viewing the memory monitoring.but after goin for othe location it again becomes FFFF, Following is the initialization code for my test code.

 

#define CLK0_DELAY   7

STATIC const IP_EMC_STATIC_CONFIG_T S29GL064S_config =
{
0,
EMC_STATIC_CONFIG_MEM_WIDTH_16 |
EMC_STATIC_CONFIG_CS_POL_ACTIVE_LOW |
EMC_STATIC_CONFIG_BLS_HIGH/* |
EMC_STATIC_CONFIG_PAGE_MODE_ENABLE |
EMC_CONFIG_BUFFER_ENABLE*/,


EMC_NANOSECOND(45),
EMC_NANOSECOND(35),
EMC_NANOSECOND(45),
EMC_NANOSECOND(35),
EMC_NANOSECOND(35),
EMC_CLOCK(4)

 

};

 

void EMC_SetupSRAMMemmory(void)
{

/* Setup EMC Delays */
/* Move all clock delays together */
LPC_SCU->EMCDELAYCLK = ((CLK0_DELAY) | (CLK0_DELAY << 4) | (CLK0_DELAY << 8) | (CLK0_DELAY << 12));

/* Setup EMC Clock Divider for divide by 2 - this is done in both the CCU (clocking)
and CREG. For frequencies over 120MHz, a divider of 2 must be used. For frequencies
less than 120MHz, a divider of 1 or 2 is ok. */
//Chip_Clock_EnableOpts(CLK_MX_EMC_DIV, true, true, 2);
LPC_CCU1->CLKCCU[CLK_MX_EMC_DIV].CFG |= (1 << 5);
LPC_CREG->CREG6 |= (1 << 16);

/* Enable EMC clock */
Chip_Clock_Enable(CLK_MX_EMC);

/* Init EMC Controller -Enable-LE mode */
Chip_EMC_Init(1, 0, 0);

/* Init EMC Static Controller CS0 */
Chip_EMC_Static_Init((IP_EMC_STATIC_CONFIG_T *) &S29GL064S_config);

LPC_EMC->STATICCONFIG0 |= 1 << 19;

}

 

/*Main Code */

#define SRAM_SIZE_BYTES (2*1024)
#define SRAM_SIZE SRAM_SIZE_BYTES

int main(void)

{

 

uint16_t *sram = (uint16_t *)(EMC_ADDRESS_CS0); /* SDRAM start address. */
uint32_t index, i;
uint32_t sramAddr;
uint16_t Data = 0XA5A5;
uint16_t Data1 = 0x5A5A;
uint8_t Flag = 0;
uint32_t *sram12= (uint16_t *)(EMC_ADDRESS_CS0);

 

for (index = 0; index < (SRAM_SIZE ); index++)
{
Chip_GPIO_SetPinToggle(LPC_GPIO_PORT, 5, 5);

if(Flag == 0 )
{
sramAddr = Data;
*(uint16_t *)(sram + index ) = sramAddr;
Flag = 1;
}
else
{
sramAddr = Data;
*(uint16_t *)(sram + index ) = sramAddr;
Flag = 0;
}

if(*(uint16_t *)(sram + index ) != sramAddr )
{
while(1);
}
}

}/* EOF Main*/

 

I have attached the test code for your reference, Please let know if there is anything missing. It is in higher priority.

Also share any reference code for SRAM interface with LPC43XX.

Thanks 

Gaurav More

Attachments

Outcomes