Hi All,
I want to interface the parallel EEPROM of 128KB(AT28LV010) to LPC 2294(MCU).to accecs the EEPROM locations I have tried the following two methods, those are
1)
unsigned char Eprom_Mem[0x20000] __attribute__ ((at(0x81000000)));
2)
unsigned int *Eprom_Mem; Eprom_Mem = (unsigned int *)0x81000000;
but neither of them is working
Keil version details are as follows:
IDE-Version: µVision V4.03q Toolchain: RealView MDK-ARM Version: 4.11 Middleware: RL-ARM Real-Time Library Version V3.21
As it is known to access external memory it is required to configure External Memory Controller(EMC) and port3 to generate the desired chip select signals for the peripherals.
In my case, The #CS1 pin of LPC 2294 is connected to #cs1 of EEPROM and to generate #CS1 for Bank1, port3 and EMC are configured using PINSEL2 and BCFG1.
BCFG1 = 0x0000FBEF; /* to configure bank config reg1 for 8bit wide EEPROM
PINSEL2 = 0x0D816914; /* to generate #cs1 on p3.26 pin */
note: #CS1 — LOW-active Chip Select 1 signal(Bank 1 addresses range 0x81000000 to 0x81FFFFFF).
After configuring the above if I try to access EEPROM the chip select (#CS1) is not getting generated from LPC 2294.
please confirm is it possible to access the external memory using __attribute__((at() ))?
what could be the reason why LPC 2294 is not generating chip select signal? Is there anything still needs to be done?
Thank you very much for your help in advance,
"As it is known to access external memory it is required to configure External Memory Controller(EMC) and port3 to generate the desired chip select signals for the peripherals."
Why is it required to? Where does your responsibility end and the compiler/linkers responsibility start? Have you investigated the startup file of your project?
Dear Sir,
Thank you very much for your response.
I have gone through the startup code and I found that it is not configuring the EMC. If EMC is not configured for 8 bit memory bank then how the processor will know to which device(8/16/32 bit wide)it has to interface?
If it is not required please let me know how it will work and also guide me what else is required to configure to generate #CS1 signal?
will it work for accessing external memory locations?
Thank you,
Yes, the linker can't configure any memory controller - code to configure must be included directly when compiling/assembling/linking the project.
Lots of Keil startup files has code for initialization of memory controller - but you need to open the configuration wizard (or edit the startup file as text) and enable and look at any configuration options for the memory controller.
Have you looked at what options the startup file has?
I have changed the startup file to configure EMC and PORT2. the code is as follows
; External Memory Controller (EMC) definitions EMC_BASE EQU 0xFFE00000 ; EMC Base Address BCFG1_OFS EQU 0x04 ; BCFG1 Offset ;// <e> External Memory Controller (EMC) EMC_SETUP EQU 1 BCFG1_SETUP EQU 1 BCFG1_Val EQU 0x0000FBEF ; to select 8bit memory device ; Setup External Memory Controller IF EMC_SETUP <> 0 ;if not equal to ZERO LDR R0, =EMC_BASE IF BCFG1_SETUP <> 0 LDR R1, =BCFG1_Val STR R1, [R0, #BCFG1_OFS] ENDIF ; External Memory Pins definitions EXTERNAL_MODE EQU 1 PINSEL2 EQU 0xE002C014 ; PINSEL2 Address PINSEL2_Val EQU 0x0D816914 ; Setup External Memory Pins IF :DEF:EXTERNAL_MODE LDR R0, =PINSEL2 LDR R1, =PINSEL2_Val STR R1, [R0] ENDIF
after doing this also #CS1 is not getting generated and then I have done the same in my C code as well even then it is not working.
please through some light.
Thank you
not only chip select line the other lines like data bus and Address bus also are not working.few lines are in high state and few are in low state.
please help me..
thank you
You need more init works to get the EMC working. Only address allocating is FAR FROM ENOUGH.
Check your manuals or sample codes to see how to initilise EMC correctly. At least 20 lines of configurations should be added to your code, I think.