EmbeddedRelated.com
Forums

LPC2478 + MT48LC4M16A2P RAM

Started by Nico Bollen May 26, 2009
Dear all,

I have an sdram device (MT48LC4M16A2P) connected as follows:

SDRAM : LPC
------------------
A0-A11 : A0-A11
A13 : BA0
A14 : BA1
DQ0-DQ15 : D0-D15
DQML : DQMOUT0
DQMH : DQMOUT1
CKE : CKEOUT0 (P2.24)
CLK : CLKOUT0 (P2.18)
CAS : CAS (P2.16)
RAS : RAS (P2.17)
WE : WE (P4.25)
CS : DYCS0 (P2.20)

My init procedure works as follows:
SCS &= ~0x00000002;
EMCControl = 0x00000001; // Enable EMC
PCONP |= PCONP_PCEMC; // Power EMC

PINSEL5 &= 0xF0FCFCC0;
PINSEL5 |= 0x05010115;
PINMODE5 &= 0xF0FCFCC0;
PINSEL6 &= 0x00000000;
PINSEL6 |= 0x55555555;
PINMODE6 &= 0x00000000;
PINSEL8 &= 0xC3000000;
PINSEL8 |= 0x14555555;
PINMODE8 &= 0xC3000000;
PINSEL9 &= 0xFFF3FFFF;
PINSEL9 |= 0x00040000;
PINMODE9 &= 0xFFF3FFFF;

EMCDynamictRP = 0x00000002; // >20ns --> 2 clk (2x14ns(ns)
EMCDynamictRAS = 0x00000003; // >44ns --> 4 clk (4x14nsVns)
EMCDynamictSREX = 0x00000007; // >75ns --> 6 clk (6x14nsns)
EMCDynamictAPR = 0x00000002; //
EMCDynamictDAL = 0x00000005; // >5clk cycles
EMCDynamictWR = 0x00000001; // >3clk cycles
EMCDynamictRC = 0x00000005; // >66ns --> 5 clk (4x14nstns)
EMCDynamictRFC = 0x00000005; // >66ns --> 5 clk (4x14nstns)
EMCDynamictXSR = 0x00000007; // >75ns --> 6 clk (6x14nsns)
EMCDynamictRRD = 0x00000001; // >15ns --> 2 clk (2x14ns(ns)
EMCDynamictMRD = 0x00000002; // >2clk cycles
EMCDynamicReadConfig = 0x00000001; // Command Delayed Strategy

EMCDynamicRasCas0 = 0x00000303; //

EMCDynamicConfig0 = 0x05<<7; // SDRAM, 4banks-4Mx16

delayMs(100);

EMCDynamicControl = 3 | (3<<7); // Issue SDRAM NOP Command

delayMs(200);

EMCDynamicControl = 3 | (2<<7); // Issue SDRAM PALL Command
EMCDynamicRefresh = 0x00000002;

for(i=0; i<0x40; i++) // wait 128 AHB clock cycles
{
asm volatile(" nop");
}

EMCDynamicRefresh = 28;

EMCDynamicControl = 3 | (1<<7); // Mem clock enable, CLKOUT

dummy = *((volatile unsigned int *)(0xA0000000 | (0x33 << 11)));
dummy = dummy;

EMCDynamicControl = 0x00000000; // Issue SDRAM NORMAL Opp Com

//Enable buffer
EMCDynamicConfig0 |= 0x01<<19; // Enable Buffer

For some strange reason I'm not able to get the EMC work correctly.
I'm writing to it like this:

*(volatile uint16_t *)(LCD_FRAMEBUFFER_START) = 0x000f;

But the data is never writen :-s
I've bin looking at this for a long time now and I don't have a solution yet therefore my request to you all.
Does anybody have an idea what I could be doing wrong, does anybody have correct initialisation and writing code examples where I could take a look at?
Many thanks in advance.

Best regards,
Nico

An Engineer's Guide to the LPC2100 Series

Hi Nico,

> does anybody have correct initialisation and writing code examples >where I could take a look at?
> Many thanks in advance.

My usual advice in such case:
- take a look on Olimex SDRAM initialization on their site.

Regards
Vladimir

--- In l..., "ljaschko" wrote:
>
> Hi Nico,
>
> > does anybody have correct initialisation and writing code examples >where I could take a look at?
> > Many thanks in advance.
>
> My usual advice in such case:
> - take a look on Olimex SDRAM initialization on their site.
>
> Regards
> Vladimir
>

Hi Vladimir,

Thanks for your reply.
I've tried to change all settings to the Olimex settings but I've still got the same problem... of course I did not change the Mode register because I'm using another RAM chip. Maybe I'm making a mistake over there?..

Regards,
Nico

--- In l..., "Nico Bollen" wrote:
>
> --- In l..., "ljaschko" wrote:
> >
> > Hi Nico,
> >
> > > does anybody have correct initialisation and writing code examples >where I could take a look at?
> > > Many thanks in advance.
> >
> > My usual advice in such case:
> > - take a look on Olimex SDRAM initialization on their site.
> >
> > Regards
> > Vladimir
> > Hi Vladimir,
>
> Thanks for your reply.
> I've tried to change all settings to the Olimex settings but I've still got the same problem... of course I did not change the Mode register because I'm using another RAM chip. Maybe I'm making a mistake over there?..
>
> Regards,
> Nico
>

Dear all,

Seems that the RAM is working but I'm only able to write maximum 60bytes to it at the same time, afterwards I have to wait several seconds before writing the next 60bytes.
The RAM content is cleared (0xFFFF) when enabling the LCD controller module...
Any ideas?
Many thanks.

Regards,
Nico

Nico,

did you have a look to earlier postings about SRAM in this group ?

If you have a wrong value in

dummy = *((volatile unsigned int *)(0xA0000000 | (0x33 << 11)));

many strange things can occur.

The value depends on the geometry of your SDRAM and is rather difficult
to calculate. Search for answers of Rolf Meeser, he's the guy who helped
me and others out of this weird issue.

Herbert

Nico Bollen schrieb:
> --- In l..., "Nico Bollen" wrote:
>
>> --- In l..., "ljaschko" wrote:
>>
>>> Hi Nico,
>>>
>>>
>>>> does anybody have correct initialisation and writing code examples >where I could take a look at?
>>>> Many thanks in advance.
>>>>
>>> My usual advice in such case:
>>> - take a look on Olimex SDRAM initialization on their site.
>>>
>>> Regards
>>> Vladimir
>>>
>>>
>> Hi Vladimir,
>>
>> Thanks for your reply.
>> I've tried to change all settings to the Olimex settings but I've still got the same problem... of course I did not change the Mode register because I'm using another RAM chip. Maybe I'm making a mistake over there?..
>>
>> Regards,
>> Nico
>>
>>
>
> Dear all,
>
> Seems that the RAM is working but I'm only able to write maximum 60bytes to it at the same time, afterwards I have to wait several seconds before writing the next 60bytes.
> The RAM content is cleared (0xFFFF) when enabling the LCD controller module...
> Any ideas?
> Many thanks.
>
> Regards,
> Nico
>
>

--

demmel products
Radnitzkygasse 43
A-1100 Vienna / Austria / Europe
Voice: +43-1-6894700-0
Fax: +43-1-6894700-40
Email: d...@demmel.com
WWW: http://www.demmel.com


Herbert,

I've read those postings.
It's very difficult to find the correct value but I think I have followed all rules...
In the meanwhile I also tried 0x33<<10 and 0x33<<12, with both combinations the behaviour was the same.

Thanks
Nico
--- In l..., Herbert Demmel wrote:
>
> Nico,
>
> did you have a look to earlier postings about SRAM in this group ?
>
> If you have a wrong value in
>
> dummy = *((volatile unsigned int *)(0xA0000000 | (0x33 << 11)));
>
> many strange things can occur.
>
> The value depends on the geometry of your SDRAM and is rather difficult
> to calculate. Search for answers of Rolf Meeser, he's the guy who helped
> me and others out of this weird issue.
>
> Herbert
>
> Nico Bollen schrieb:
> > --- In l..., "Nico Bollen" wrote:
> >
> >> --- In l..., "ljaschko" wrote:
> >>
> >>> Hi Nico,
> >>>
> >>>
> >>>> does anybody have correct initialisation and writing code examples >where I could take a look at?
> >>>> Many thanks in advance.
> >>>>
> >>> My usual advice in such case:
> >>> - take a look on Olimex SDRAM initialization on their site.
> >>>
> >>> Regards
> >>> Vladimir
> >>>
> >>>
> >> Hi Vladimir,
> >>
> >> Thanks for your reply.
> >> I've tried to change all settings to the Olimex settings but I've still got the same problem... of course I did not change the Mode register because I'm using another RAM chip. Maybe I'm making a mistake over there?..
> >>
> >> Regards,
> >> Nico
> >>
> >>
> >
> > Dear all,
> >
> > Seems that the RAM is working but I'm only able to write maximum 60bytes to it at the same time, afterwards I have to wait several seconds before writing the next 60bytes.
> > The RAM content is cleared (0xFFFF) when enabling the LCD controller module...
> > Any ideas?
> > Many thanks.
> >
> > Regards,
> > Nico
> >
> >
>
> --
>
> demmel products
> Radnitzkygasse 43
> A-1100 Vienna / Austria / Europe
> Voice: +43-1-6894700-0
> Fax: +43-1-6894700-40
> Email: dh@...
> WWW: http://www.demmel.com
>
>

Dear all,

I've just checked the exact number of bytes which can be writen in 1 time, it seems to be 64 bytes, exactly the size of the internal buffer of the EMC. After writing these bytes I have to wait several minutes before writing other bytes, otherwise the RAM content is scrumbled up...
So writing to RAM takes a lot of time, is this normal??

Any ideas are welcome, thanks.

Regards,
Nico

--- In l..., "Nico Bollen" wrote:
>
> Herbert,
>
> I've read those postings.
> It's very difficult to find the correct value but I think I have followed all rules...
> In the meanwhile I also tried 0x33<<10 and 0x33<<12, with both combinations the behaviour was the same.
>
> Thanks
> Nico
> --- In l..., Herbert Demmel wrote:
> >
> > Nico,
> >
> > did you have a look to earlier postings about SRAM in this group ?
> >
> > If you have a wrong value in
> >
> > dummy = *((volatile unsigned int *)(0xA0000000 | (0x33 << 11)));
> >
> > many strange things can occur.
> >
> > The value depends on the geometry of your SDRAM and is rather difficult
> > to calculate. Search for answers of Rolf Meeser, he's the guy who helped
> > me and others out of this weird issue.
> >
> > Herbert
> >
> > Nico Bollen schrieb:
> > > --- In l..., "Nico Bollen" wrote:
> > >
> > >> --- In l..., "ljaschko" wrote:
> > >>
> > >>> Hi Nico,
> > >>>
> > >>>
> > >>>> does anybody have correct initialisation and writing code examples >where I could take a look at?
> > >>>> Many thanks in advance.
> > >>>>
> > >>> My usual advice in such case:
> > >>> - take a look on Olimex SDRAM initialization on their site.
> > >>>
> > >>> Regards
> > >>> Vladimir
> > >>>
> > >>>
> > >> Hi Vladimir,
> > >>
> > >> Thanks for your reply.
> > >> I've tried to change all settings to the Olimex settings but I've still got the same problem... of course I did not change the Mode register because I'm using another RAM chip. Maybe I'm making a mistake over there?..
> > >>
> > >> Regards,
> > >> Nico
> > >>
> > >>
> > >
> > > Dear all,
> > >
> > > Seems that the RAM is working but I'm only able to write maximum 60bytes to it at the same time, afterwards I have to wait several seconds before writing the next 60bytes.
> > > The RAM content is cleared (0xFFFF) when enabling the LCD controller module...
> > > Any ideas?
> > > Many thanks.
> > >
> > > Regards,
> > > Nico
> > >
> > >
> >
> > --
> >
> > demmel products
> > Radnitzkygasse 43
> > A-1100 Vienna / Austria / Europe
> > Voice: +43-1-6894700-0
> > Fax: +43-1-6894700-40
> > Email: dh@
> > WWW: http://www.demmel.com
> >
> >
> >
>