DSPRelated.com
Forums

loading data into SDRAM

Started by s.mo...@gmail.com June 10, 2009
Hi,

I am using ADSP21369 and I am able to write and read from SDRAM (MT48LC4M32B2 128MB). I have few questions and will be grateful if anyone could help

1) My SDRAM is connect to bank 0. At the moment I am giving the SDRAM start and SDRAM size as
#define SDRAM_START 0x00200000// start address of SDRAM
#define SDRAM_SIZE 0x00100000// size of SDRAM in 32-bit words.(i.e. 1M x 32)

I am able to write using
for(nIndex = 0, pDst = (unsigned int *)SDRAM_START; pDst < (unsigned int *)(SDRAM_START + SDRAM_SIZE); pDst++, nIndex++ )
{
*pDst = nIndex;
}

In the data sheet the size of bank 00 is given as
Bank Size Address Range
Bank 0 62 Mwords 0x0020 0000 – 0x03FF FFFF

Can anyone please exaplain how the 62M words from 0x0020 0000 will give end address as 0x03FF FFFF.

2) How can I initialise say "int test_array ={1,2,3,4,5,6}" so that it resides in the SDRAM.

Thanks,
sm
On Wed, 10 Jun 2009, s...@gmail.com wrote:

> Hi,
>
> I am using ADSP21369 and I am able to write and read from SDRAM (MT48LC4M32B2 128MB). I have few questions and will be grateful if anyone could help
>
> 1) My SDRAM is connect to bank 0. At the moment I am giving the SDRAM start and SDRAM size as
> #define SDRAM_START 0x00200000// start address of SDRAM
> #define SDRAM_SIZE 0x00100000// size of SDRAM in 32-bit words.(i.e. 1M x 32)
>
> I am able to write using
> for(nIndex = 0, pDst = (unsigned int *)SDRAM_START; pDst < (unsigned int *)(SDRAM_START + SDRAM_SIZE); pDst++, nIndex++ )
> {
> *pDst = nIndex;
> }
>
> In the data sheet the size of bank 00 is given as
> Bank Size Address Range
> Bank 0 62 Mwords 0x0020 0000 – 0x03FF FFFF
>
> Can anyone please exaplain how the 62M words from 0x0020 0000 will give
>end address as 0x03FF FFFF.

That one is easy. 1 million hex = 0x100000, so 64 million hex = 0x4000000
Since you lose 2 million given the starting address, the last address of
0x3ffffff is 62 million words.

> 2) How can I initialise say "int test_array ={1,2,3,4,5,6}" so that it
>resides in the SDRAM.

You might have to specify a section of sdram in the linker which holds
constants - but check the compilerr/linker manual and see if it knows how
to load arbitrary sections. Otherwise you'll have to do it when you first
start your program.

Patience, persistence, truth,
Dr. mike
Hi sm,

62M is 0x03E0 0000 in hex. Add the start address of 0x0020 0000 to get 0x0400 0000. Since the 62M locations are at an offset of 0x0000 0000 to 0x03DF FFFF relative to the start, the last address in Bank 0 is actually 0x03FF FFFF.

Use section("My_Extern_Section") int test_array ={1,2,3,4,5,6};, where My_Extern_Section is defined in the LDF as being mapped to one of the SDRAM banks. It turns out that the default LDF maps sections with the name "seg_sdram" to Bank 0. If you use this name, you would not have to modify the LDF. You will want to look over the Linker and Utilities Manual for more info on mapping input sections to memory segments.

Best regards,

George Kadziolka
Kaztek Systems
URL: www.kaztek.com


-----Original Message-----
From: a... [mailto:a...] On Behalf Of s.moos...@gmail.com
Sent: Wednesday, June 10, 2009 10:07 AM
To: a...
Subject: [adsp] loading data into SDRAM

Hi,

I am using ADSP21369 and I am able to write and read from SDRAM (MT48LC4M32B2 128MB). I have few questions and will be grateful if anyone could help

1) My SDRAM is connect to bank 0. At the moment I am giving the SDRAM start and SDRAM size as
#define SDRAM_START 0x00200000// start address of SDRAM
#define SDRAM_SIZE 0x00100000// size of SDRAM in 32-bit words.(i.e. 1M x 32)

I am able to write using
for(nIndex = 0, pDst = (unsigned int *)SDRAM_START; pDst < (unsigned int *)(SDRAM_START + SDRAM_SIZE); pDst++, nIndex++ )
{
*pDst = nIndex;
}

In the data sheet the size of bank 00 is given as
Bank Size Address Range
Bank 0 62 Mwords 0x0020 0000 – 0x03FF FFFF

Can anyone please exaplain how the 62M words from 0x0020 0000 will give end address as 0x03FF FFFF.

2) How can I initialise say "int test_array ={1,2,3,4,5,6}" so that it resides in the SDRAM.

Thanks,
sm
Hi,
>
> I am using ADSP21369 and I am able to write and read from SDRAM (MT48LC4M32B2 128MB). I have few questions and will be grateful if anyone could help
>
>1) My SDRAM is connect to bank 0. At the moment I am giving the SDRAM start and SDRAM size as
>#define SDRAM_START 0x00200000// start address of SDRAM
>#define SDRAM_SIZE 0x00100000// size of SDRAM in 32-bit words.(i.e. 1M x 32)
>
>I am able to write using
>for(nIndex = 0, pDst = (unsigned int *)SDRAM_START; pDst < (unsigned int *)(SDRAM_START + SDRAM_SIZE); pDst++, nIndex++ )
> {
> *pDst = nIndex;
> }
>
>In the data sheet the size of bank 00 is given as
>Bank Size Address Range
>Bank 0 62 Mwords 0x0020 0000 – 0x03FF FFFF
>
>Can anyone please exaplain how the 62M words from 0x0020 0000 will give end address as 0x03FF FFFF.
>
>2) How can I initialise say "int test_array ={1,2,3,4,5,6}" so that it resides in the SDRAM.
>
> Thanks,
> sm

Hi All,

Thanks very much for your help.

SM
Hi,

62 M words = 62*1024*1024 = 65011712 words.

Each word is held by one decoded address .

Since the address starts from 0x0020 0000 (which is from 0 to ... and not 1 to .....), the last address will be

0x0020 0000 + (65011712 -1) base 16 = 0x03FF FFFF.

hope you got the answer.

Cheers!!

Nagaraj

+91-9600076673

________________________________
From: "s...@gmail.com"
To: a...
Sent: Fri, 12 June, 2009 3:03:56 PM
Subject: [adsp] Re: loading data into SDRAM

Hi,
>
> I am using ADSP21369 and I am able to write and read from SDRAM (MT48LC4M32B2 128MB). I have few questions and will be grateful if anyone could help
>
>1) My SDRAM is connect to bank 0. At the moment I am giving the SDRAM start and SDRAM size as
>#define SDRAM_START 0x00200000// start address of SDRAM
>#define SDRAM_SIZE 0x00100000// size of SDRAM in 32-bit words.(i.e. 1M x 32)
>
>I am able to write using
>for(nIndex = 0, pDst = (unsigned int *)SDRAM_START; pDst < (unsigned int *)(SDRAM_START + SDRAM_SIZE); pDst++, nIndex++ )
> {
> *pDst = nIndex;
> }
>
>In the data sheet the size of bank 00 is given as
>Bank Size Address Range
>Bank 0 62 Mwords 0x0020 0000 – 0x03FF FFFF
>
>Can anyone please exaplain how the 62M words from 0x0020 0000 will give end address as 0x03FF FFFF.
>
>2) How can I initialise say "int test_array ={1,2,3,4,5,6}" so that it resides in the SDRAM.
>
> Thanks,
> sm

Hi All,

Thanks very much for your help.

SM

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/