Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: SDRAM (MT48LC8M16A2)initializing problem with AT91RM9200 :(
PostPosted: Mon Jan 24, 2005 7:45 am 
Offline

Joined: Sat Jan 01, 2005 6:57 am
Posts: 8
Location: India
Hi,

Im having problems setting up a pair of 128Mb SDRAMs (MT48LC8M16A2) to work with my custom AT91RM9200 board (The RAM modeule is the same as the one used on the DK) . I am relying on the debug unit to send back the read value to HyperTerminal.
(Seems like the SDRAM is not holding on to the data)

Below is my initialization code:

Code:
+++++++++++++++++++++++++

int i;
int *pSDRAM = (int *)BASE_EBI_CS1_ADDRESS;

//* Configure PIOC as peripheral (D16/D31)
AT91F_SDRC_CfgPIO();

//* Setup MEMC to support CS1=SDRAM
AT91C_BASE_EBI->EBI_CSA |= AT91C_EBI_CS1A;
AT91C_BASE_EBI->EBI_CFGR = 0;

//* Init SDRAM

AT91C_BASE_SDRC->SDRC_CR =
0x01 |//NC=9 columns
0x04 |//NR=12 rows
0x08 |//NB=4 banks
0x40 |//CAS=4
0x100 |//TWR=2
0x2800 |//TRC=5
0x10000 |//TRP=2
0x180000 |//TRCD=3
0x2800000 |//TRAS=5
0x28000000 //TXSR=5
;

//* 2. A Precharge All command is issued to the SDRAM
AT91C_BASE_SDRC->SDRC_MR = AT91C_SDRC_MODE_PRCGALL_CMD;
*pSDRAM = 0;

//* 3. Eight Auto-refresh are provided
AT91C_BASE_SDRC->SDRC_MR = AT91C_SDRC_MODE_RFSH_CMD;
for(i=0;i<7;i++)
*pSDRAM = 0;

//* 4. A mode register cycle is issued to program the SDRAM parameters
AT91C_BASE_SDRC->SDRC_MR = AT91C_SDRC_MODE_LMR_CMD;
*(pSDRAM+0x80) = 0;

//4.5 Three NOPs to take care of tMRD
AT91C_BASE_SDRC->SDRC_MR = AT91C_SDRC_MODE_NOP_CMD;
for(i=0; i<2; i++)
*pSDRAM = 0;


//* 6. A Normal Mode Command is provided, 3 clocks after tMRD is set
//Normal Mode, 32 bit word length
AT91C_BASE_SDRC->SDRC_MR = 0x0;
*pSDRAM = 0;

//* 5. Write refresh rate into SDRAMC refresh timer COUNT register
AT91C_BASE_SDRC->SDRC_TR = (AT91C_SDRC_COUNT & 0x2E0);//4096 refresh cycles every 64ms
*pSDRAM = 0;

=================================================
this is how im checking the SDRAM:


volatile char *base = (char *)0x20000000;
volatile int *base2 = (int *)0x20000000;

char buf[10];

*base2 = 0xAABBCCDD;

sprintf( buf, "%x\r\n", *(base2));
AT91F_DBGU_Printk( buf );
AT91F_DBGU_Printk( "\r\n=============\r\n" );

sprintf( buf,"\r\n%x\r\n", *(base2));
AT91F_DBGU_Printk( buf );

++++++++++++++++++++++++++++++++++++++
As you can see, im reading the same location twice..to check whether the RAM is

"holding on" to the data;turns out that its not;
++++++++++++++++++++++++++++++++++++++

Output:

aabbccdd
=============
ffffffff

++++++++++++++++++++++++++++++++++++++

The second read of the same location does not find anything..also, if i put a delay between the write and the read, i find nothing!

Code:
++++++++++++++++++++++++++++++++++++++
*base2 = 0xAABBCCDD;

delay();
sprintf( buf, "%x\r\n", *(base2));
AT91F_DBGU_Printk( buf );
++++++++++++++++++++++++++++++++++++++

Output:
ffffffff

++++++++++++++++++++++++++++++++++++++

Looks like a problem with the refresh rate...but ive checked and rechecked
everything! Help!

Could it be a problem with the hardware (i mean, the board, not the ram chips.)

Thanks in anticipation
Mayank


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: