PLEASE SEE THE ATTACHED WORD DOCUMENT FOR DETAILED DESCRIPTION OF THE PROBLEM.
We are trying to read/write data in to the NVSRAM.For this we have configured the EMC registers as follows: In this we want to configure the EMC Static chip selects to use for the Chip select of NVSRAM. Also as mentioned in the schematic, we intend to configure the EMC for other control signals like OE, BLS0, BLS1,BLS2, WE for the NVSRAM access. In order to generate chip select for the NVSRAM we have used the corresponding memory address range as mentioned in the LPC1788 manual . ( EMC_CS3 , P2.15) The WE signal coming out of the EMC from LPC is used to control the direction of the data buffer for Read/Write Control. The problem is when we are trying to write data and read back from the same memory location of the NVSRAM , then the Chip select is properly generated and WE signal also shows pulsed variations in levels for write and read operations( WE is Low when writing and High when Reading).But when we initiate ONLY READ Operation for reading data from the NVSRAM, the chip selects also is not generated also there is no WE signal too. We are unable to read back the data. Similarly in case of our external ADC we have assigned EMC Static chip selects (EMC_CS0,P4.30)of the EMC to the ADC. Now as there is only read operation involved in the ADC data reading , again we are not getting any chip selects for the same.
Hi,
Please have a look at the EMC registers and review them for corrections, if any
LPC_EMC->pconp=0x00000800
LPC_EMC->control=0x00000005 ( This is the value given before the EMC registers are configured ( for low power mode), at the end of initialization of all the registers, the value is set to 0x00000001, for normal power mode)
LPC_EMC->config=0x00000000
LPC_EMC->SCS=0x00000025 ( as suggested by you)
LPC_EMC->StaticConfig3 = 0x00080081( also for StaticConfig0,StaticConfig1,StaticConfig2)
LPC_EMC->EMCCLKSEL=0x00000001
LPC_
Hi,
I have checked your schematics and the code.
Because you use 16 bits data width SRAM, you should have connected the EMC_A1 to SRAM_A0, EMC_A2 to SRAM_A1,... But you connect the EMC_A0 to SRAM_A0, EMC_A1 to SRAM_A1,....
In you connection that EMC_A0 to SRAM_A0, EMC_A1 to SRAM_A1,...are connected, you have to set the EMCSC bit in SCS register
LPC_SC->SCS=0x00000025; // The EMCES bit must be set
I have checked the timing configuration, I think it is okay
LPC_EMC->StaticConfig3 = 0x00080001; //working
//LPC_EMC->StaticConfig3 = 0x00080101; // Bit 1:0: 01 for 16 bit, bit 6=0 Chip Slect Low
// Bit 8=0 Extended wait disabled, bit 19 Buffer disable, Bit 20=0 Write Not protected
LPC_EMC->StaticWaitWen3 = 0x0000000F; // Bit Static Memory write enable delay
LPC_EMC->StaticWaitOen3 = 0x0000000F; // Bit Static Memory write enable delay
LPC_EMC->StaticWaitRd3 = 0x0000001F; // Bit Static Memory write enable delay
LPC_EMC->StaticWaitPage3 = 0x00000000; // Bit Static Memory write enable delay
LPC_EMC->StaticWaitWr3 = 0x0000001F; // Bit Static Memory write enable delay
LPC_EMC->StaticWaitTurn3 = 0x0000000F; // Bit Static Memory write enable delay
When you access the external memory, I suggest you use a loop so that you can see if the timing is correct
uint16_t temp;
for(;;)
{
*(uint16_t *)NVsram_locationfor2=0xaaaa; //using 16 bits access
__asm("nop");
temp=*(uint16_t *)NVsram_locationfor2;
__asm("nop");
}
Hope it can help you
BR
XiangJun Rong