EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Access to SRAM(Read/Write)]

Started by ashu...@kanalsolutions.com July 4, 2009
Hi,
i am new to this group in one of my application i have to read/write
external SRAM, i have initialised my emc settings,but being new to the
ARM7 i do not know the routine to access SRAM. can anybody help me in this
regard.

I am using
LPC2468 (NXP)//32bit microcontroller
CY7C1061BV33(cypress)//2 MB external SRAM

Regards

Tripathi Ashutosh

An Engineer's Guide to the LPC2100 Series

---------------------------- Original Message ----------------------------
Subject: Re: [lpc2000] Re: Access to SRAM(Read/Write)
From: a...@kanalsolutions.com
Date: Tue, June 30, 2009 3:47 am
To: l...
--

> i am using Keil Arm compiler
i have only configuring my emc(external SRAM)
and i am trying to write some data lets say 0xAA on SRAM location
0x80000000.
emc setting is as follows.....

/*pin connect block*/
PINSEL6 = 0x55555555; //D[15:0]/P3[15:0] //if memory can be used as
external boot memory setting for p[15:14]= 10 by cs1.
//in this case it is reserved, do not use.

/*Pin has neither pull up nor pull down*/
PINMODE6 = 0xAAAAAAAA; //mode 10

PINSEL8 = 0x55555555 ;//A[15:0]/P4[15:0]
PINMODE8 = 0xAAAAAAAA ;// mode 10

PINSEL9 = 0x40550055 ;//A[19:16]/P4[19:16 & 31:30 & 27:24]
PINMODE9 = 0xAAAAAAAA ;//mode 10
//Step2: Enable EMC and set EMC parameter

/*Enable EMC power */
PCONP |= 0x800 ;

/* Enable EMC*/
EMC_CTRL = 1 ;

/*PLL is bypassed*/
CCLKCFG = 0x1;
/*AHB slave memory interface & data buffers*/

EMC_CONFIG = ENDIAN_MODE_BIT ;//little endian

EMC_STA_CFG0 = MEM_WDTH |PAGE_MODE |BYTE_LANE_STATE | 1<< 19 ; //32 bits
initially data buffers are dissabled

EMC_STA_WAITWEN0 = 0x2;

EMC_STA_WAITOEN0 = 0x2;

// EMC_STA_WAITRD0 = 0x1F;

EMC_STA_WAITPAGE0 = 0x1F;

EMC_STA_WAITWR0 = 0x1F;

EMC_STA_WAITTURN0 = 0x0F;

EMC_STA_EXT_WAIT = 0x00; // Extended wait time, 16CCLK

EMC_STAT = 0 ;

cReturnValue = WriteToSram() ;

> Done any programming?
>
> What compiler you are using?
>
> --- In l..., ashutosh@... wrote:
>>
>> Hi,
>> i am new to this group in one of my application i have to read/write
>> external SRAM, i have initialised my emc settings,but being new to the
>> ARM7 i do not know the routine to access SRAM. can anybody help me in
>> this
>> regard.
>>
>> I am using
>> LPC2468 (NXP)//32bit microcontroller
>> CY7C1061BV33(cypress)//2 MB external SRAM
>>
>> Regards
>>
>> Tripathi Ashutosh
>

>
>> i am using Keil Arm compiler
> i have only configuring my emc(external SRAM)
> and i am trying to write some data lets say 0xAA on SRAM location
> 0x80000000.
> emc setting is as follows.....
>
> /*pin connect block*/
> PINSEL6 = 0x55555555; //D[15:0]/P3[15:0] //if memory can be used as
> external boot memory setting for p[15:14]= 10 by cs1.
> //in this case it is reserved, do not use.
>
> /*Pin has neither pull up nor pull down*/
> PINMODE6 = 0xAAAAAAAA; //mode 10
>
> PINSEL8 = 0x55555555 ;//A[15:0]/P4[15:0]
> PINMODE8 = 0xAAAAAAAA ;// mode 10
>
> PINSEL9 = 0x40550055 ;//A[19:16]/P4[19:16 & 31:30 & 27:24]
> PINMODE9 = 0xAAAAAAAA ;//mode 10
> //Step2: Enable EMC and set EMC parameter
>
> /*Enable EMC power */
> PCONP |= 0x800 ;
>
> /* Enable EMC*/
> EMC_CTRL = 1 ;
>
> /*PLL is bypassed*/
> CCLKCFG = 0x1;
> /*AHB slave memory interface & data buffers*/
>
> EMC_CONFIG = ENDIAN_MODE_BIT ;//little endian
>
> EMC_STA_CFG0 = MEM_WDTH |PAGE_MODE |BYTE_LANE_STATE | 1<< 19 ; //32 bits
> initially data buffers are dissabled
>
> EMC_STA_WAITWEN0 = 0x2;
>
> EMC_STA_WAITOEN0 = 0x2;
>
> // EMC_STA_WAITRD0 = 0x1F;
>
> EMC_STA_WAITPAGE0 = 0x1F;
>
> EMC_STA_WAITWR0 = 0x1F;
>
> EMC_STA_WAITTURN0 = 0x0F;
>
> EMC_STA_EXT_WAIT = 0x00; // Extended wait time, 16CCLK
>
> EMC_STAT = 0 ;
>
> cReturnValue = WriteToSram() ;
>
>> Done any programming?
>>
>> What compiler you are using?
>>
>> --- In l..., ashutosh@... wrote:
>>>
>>> Hi,
>>> i am new to this group in one of my application i have to read/write
>>> external SRAM, i have initialised my emc settings,but being new to the
>>> ARM7 i do not know the routine to access SRAM. can anybody help me in
>>> this
>>> regard.
>>>
>>> I am using
>>> LPC2468 (NXP)//32bit microcontroller
>>> CY7C1061BV33(cypress)//2 MB external SRAM
>>>
>>>
>>>
>>> Regards
>>>
>>> Tripathi Ashutosh
>

So what's your point ?

If you got nothing to do, don't repost your junk email here.

-daniel

--- On Mon, 7/6/09, a...@kanalsolutions.com wrote:

From: a...@kanalsolutions.com
Subject: [lpc2000] Access to SRAM(Read/Write)]
To: l...
Date: Monday, July 6, 2009, 10:07 AM
>> i am using Keil Arm compiler

> i have only configuring my emc(external SRAM)
> and i am trying to write some data lets say 0xAA on SRAM location
> 0x80000000.
> emc setting is as follows.....
>
> /*pin connect block*/
> PINSEL6 = 0x55555555; //D[15:0]/P3[ 15:0] //if memory can be used as
> external boot memory setting for p[15:14]= 10 by cs1.
> //in this case it is reserved, do not use.
>
> /*Pin has neither pull up nor pull down*/
> PINMODE6 = 0xAAAAAAAA; //mode 10
>
> PINSEL8 = 0x55555555 ;//A[15:0]/P4[ 15:0]
> PINMODE8 = 0xAAAAAAAA ;// mode 10
>
> PINSEL9 = 0x40550055 ;//A[19:16]/ P4[19:16 & 31:30 & 27:24]
> PINMODE9 = 0xAAAAAAAA ;//mode 10
> //Step2: Enable EMC and set EMC parameter
>
> /*Enable EMC power */
> PCONP |= 0x800 ;
>
> /* Enable EMC*/
> EMC_CTRL = 1 ;
>
> /*PLL is bypassed*/
> CCLKCFG = 0x1;
> /*AHB slave memory interface & data buffers*/
>
> EMC_CONFIG = ENDIAN_MODE_ BIT ;//little endian
>
> EMC_STA_CFG0 = MEM_WDTH |PAGE_MODE |BYTE_LANE_STATE | 1<< 19 ; //32 bits
> initially data buffers are dissabled
>
> EMC_STA_WAITWEN0 = 0x2;
>
> EMC_STA_WAITOEN0 = 0x2;
>
> // EMC_STA_WAITRD0 = 0x1F;
>
> EMC_STA_WAITPAGE0 = 0x1F;
>
> EMC_STA_WAITWR0 = 0x1F;
>
> EMC_STA_WAITTURN0 = 0x0F;
>
> EMC_STA_EXT_ WAIT = 0x00; // Extended wait time, 16CCLK
>
> EMC_STAT = 0 ;
>
> cReturnValue = WriteToSram( ) ;



Dear members i am facing access violation while writing to SRAM.
i am configuring External SRAM(CS0,CS1,BLS0,BLS1,OE,WE),
the starting address of the offchip sram is 0x80000000 and the size is
0x200000 (2MB),also i have to sectorize the memory into the various parts
such as :
A: Address 80000000 //512 kb
B: Address 80080000//512 kb
C: Address 80100000//256 kb
D: Address 80140000//256 kb

also i have a qry to how to sectorize 512 kb of A: Address range into 64
groups...

if anybody have an idea regarding this
....
please reply me as early as possible.........

regards

Tripathi

---------------------------- Original Message ----------------------------
Subject: Re: [lpc2000] Re:Access to SRAM(Read/Write)
From: a...@kanalsolutions.com
Date: Wed, July 1, 2009 3:42 am
To: l...
--

Dear members,

I have many queries regarding External SRAM
1)i have a problem to sectorize my sram(2MB)
lets i divide my sram into 256K blocks .
how i do this.
i search for "External SRAM" in help icon of Vision3(Keil Arm).
where i found in the target option there has one setting of "use memory
layout from target dialog" in "Linker" .
and how i can create scatter file.

2)there has an access violation when we write some data lets say 5 on
address 0x80000000,When we debug the program
we select CS0 because its capacity is 16 MB and i am using 2 MB.

Regards,

Tripathi ashutosh

> Dear Tripathi,
>
> I had this same problem. After several weeks I received an answer from a
> kind member of this forum. This solved my problem. Please see below.
>
> Regards,
>
> Bruce
>> Hi,
>>
>> I finally wrote to NXP , adn after1 month , I got an answer ...
>> In fact the EMC controller is the same on LPC2378/88 and LPC2478. But
>> some
> registers are not used on LPC23xx.
>> And some of the LPC24XX are used but ... not documented !
>> There's a register you have to reset to disable theself refreshing of
> theRAM (and it's activated on reset)
>>
>> #define EMC_BASE_ADDR0xFFE08000
>> #define EMC_DYN_CTRL (*(volatile unsigned long *)(EMC_BASE_ADDR +
> 0x020)).
>>
>> After that the Stat register is operating with the correct behavior.
>>
>> I hope it helps


The 2024 Embedded Online Conference