DSPRelated.com
Forums

External memory(SDRAM) of 6713

Started by nikita iyer February 17, 2012
Hi all,
I am doing a project on DSK6713 (Spectrum Digital) and using CCS V3.1 in
which I need to interleave/mux voice input and data(for eg textual) and
deinterleave/demux them.
I have created sections in the external memory (SDRAM 16Mb) for storing the
voice input, textual data and multiplexed/interleaved data.

A relevant portion of the code is as follows
******
*Uint16 wavbuf[50000],txtbuf[50000];*
*Uint16 muxbuf[100000];*
*
*
*#pragma DATA_SECTION(wavbuf,".wav");*
*#pragma DATA_SECTION(muxbuf,".mux");*
*#pragma DATA_SECTION(txtbuf,".textual");*
*
*
*
*
*void main()*
*{*
* while(!feof(fpr)) //fpr points to the .txt file pointer from
which data is to be taken*
* {*
* txtbuf[len++]=fgetc(fpr); //storing txt data in memory*
* }*
*
*
* for(i=0;i<20000;i++)*
* wavbuf[i]= input_left_sample();*
* }*
The cmd file is as follows

*MEMORY*
*{*
*
*
* IVECS: org=0h, len=0x220*
* IRAM: org=0x00000220, len=0x0002FDE0 /*internal memory*/*
* SDRAM: org=0x80000000, len=0x01000000 /*external memory*/*
* FLASH: org=0x90000000, len=0x00020000 /*flash memory*/ *
* wavemem:org=0x81000000,len=0x00100000*
* txtmem: org=0x82000000,len=0x00100000*
* muxmem: org=0x83000000,len=0x00100000 *
*}*
*
*
*SECTIONS*
*{ *
* .wav :> wavemem*
*.mux :> muxmem*
*.textual :> txtmem*
* .vectors :> IVECS /*in vector file*/*
* .text :> IRAM /*Created by C Compiler*/*
* .bss :> IRAM*
* .cinit :> IRAM*
* .stack :> IRAM*
* .sysmem :> IRAM*
* .const :> IRAM*
* .switch :> IRAM*
* .far :> IRAM*
* .cio :> IRAM*
* .csldata :> IRAM*
*}*
***************
The problem I'm facing is that when the voice input is written into the
array wavbuf the same data is written into txtbuf (which initially stores
the textual data properly). Thus the textual data in txtbuf gets overriden.

I have also tried the same thing with pointers but the same thing is
repeated.
code snippet as follows
*************
*Uint16 * wavptr, * txtptr, * muxptr , * bptr; *
*
*
*txtptr=&(txtbuf[0]);*
*while(!feof(fpr)) *
* {*
* *(txtptr++)=fgetc(fpr); //storing txt data in memory*
* }*
*
*
*wavptr=&(wavbuf[0]);*
* for(i=0;i<20000;i++)*
* * (wavptr++)= input_left_sample();*

*****************
I probably have gone wrong with the sections directive or pointer
assignment.I have also tried reversing the order i.e storing values in
wavbuf first and then txtbuf but overwriting continues
I have also tried creating just one section(say just SDRAM) and storing all
arrays there. In that case, when i view the memory map,it shows the 2nd
array (here wavbuf) at location 0x09000000(which is for FLASH memory I
guess). Dont know why it happens Please help me with any suggestions.

Thanking in advance
Nikita Iyer
Hi Nikita,

You say that SDRAM size is 16MB, which means the first address offset past
it has to be no further than bit 24 or 0x01000000 hex:

> SDRAM: org=0x80000000, len=0x01000000 /* external memory */

which seem to be correct. But then you allocate three new spaces at
16MB, 32MB and 48MB offsets, where there are physically no transistors
to play with :)

Reconsider the base addresses for the last three memory regions:

wavemem: org=0x80100000, len=0x00100000 /* @ 1MB offset */
txtmem: org=0x80200000, len=0x00100000 /* @ 2MB offset */
muxmem: org=0x80300000, len=0x00100000 /* @ 3MB offset */

That should work out for you; but even that, this layout thrashes the
last 12MB of available SDRAM, provided that the SDRAM region at
0x80000000 base address should not go beyond the first 1MB offset.

I'd use the last 3MB as follows:

SDRAM org = 0x80000000, len = 0x00D00000 /* 13MB */
wavemem org = 0x80D00000, len = 0x00100000 /* 1MB */
txtmem org = 0x80E00000, len = 0x00100000 /* 1MB */
muxmem org = 0x80F00000, len = 0x00100000 /* 1MB */

Rgds,

Andrew

P.S.

> location 0x09000000(which is for FLASH memory I guess)

You've got to feel the difference between the above address and the one in the
.cmd file. Think hexadecimal :)
> Subject: External memory(SDRAM) of 6713
> Posted by: "nikita iyer" n...@gmail.com nice_niki_9
> Date: Fri Feb 17, 2012 10:18 am ((PST))
>
> Hi all,
> I am doing a project on DSK6713 (Spectrum Digital) and using CCS V3.1 in
> which I need to interleave/mux voice input and data(for eg textual) and
> deinterleave/demux them.
> I have created sections in the external memory (SDRAM 16Mb) for storing the
> voice input, textual data and multiplexed/interleaved data.
>
> A relevant portion of the code is as follows
> ******
> *Uint16 wavbuf[50000],txtbuf[50000];*
> *Uint16 muxbuf[100000];*
> *
> *
> *#pragma DATA_SECTION(wavbuf,".wav");*
> *#pragma DATA_SECTION(muxbuf,".mux");*
> *#pragma DATA_SECTION(txtbuf,".textual");*
> *
> *
> *
> *
> *void main()*
> *{*
> * while(!feof(fpr)) //fpr points to the .txt file pointer from
> which data is to be taken*
> * {*
> * txtbuf[len++]=fgetc(fpr); //storing txt data in memory*
> * }*
> *
> *
> * for(i=0;i<20000;i++)*
> * wavbuf[i]= input_left_sample();*
> * }*
> The cmd file is as follows
>
> *MEMORY*
> *{*
> *
> *
> * IVECS: org=0h, len=0x220*
> * IRAM: org=0x00000220, len=0x0002FDE0 /*internal memory*/*
> * SDRAM: org=0x80000000, len=0x01000000 /*external memory*/*
> * FLASH: org=0x90000000, len=0x00020000 /*flash memory*/ *
> * wavemem: org=0x81000000, len=0x00100000*
> * txtmem: org=0x82000000, len=0x00100000*
> * muxmem: org=0x83000000, len=0x00100000 *
> *}*
> *
> *
> *SECTIONS*
> *{ *
> * .wav :> wavemem*
> *.mux :> muxmem*
> *.textual :> txtmem*
> * .vectors :> IVECS /*in vector file*/*
> * .text :> IRAM /*Created by C Compiler*/*
> * .bss :> IRAM*
> * .cinit :> IRAM*
> * .stack :> IRAM*
> * .sysmem :> IRAM*
> * .const :> IRAM*
> * .switch :> IRAM*
> * .far :> IRAM*
> * .cio :> IRAM*
> * .csldata :> IRAM*
> *}*
> ***************
> The problem I'm facing is that when the voice input is written into the
> array wavbuf the same data is written into txtbuf (which initially stores
> the textual data properly). Thus the textual data in txtbuf gets overriden.
>
> I have also tried the same thing with pointers but the same thing is
> repeated.
> code snippet as follows
> *************
> *Uint16 * wavptr, * txtptr, * muxptr , * bptr; *
> *
> *
> *txtptr=&(txtbuf[0]);*
> *while(!feof(fpr)) *
> * {*
> * *(txtptr++)=fgetc(fpr); //storing txt data in memory*
> * }*
> *
> *
> *wavptr=&(wavbuf[0]);*
> * for(i=0;i<20000;i++)*
> * * (wavptr++)= input_left_sample();*
>
> *****************
> I probably have gone wrong with the sections directive or pointer
> assignment.I have also tried reversing the order i.e storing values in
> wavbuf first and then txtbuf but overwriting continues
> I have also tried creating just one section(say just SDRAM) and storing all
> arrays there. In that case, when i view the memory map,it shows the 2nd
> array (here wavbuf) at location 0x09000000(which is for FLASH memory I
> guess). Dont know why it happens Please help me with any suggestions.
>
> Thanking in advance
> Nikita Iyer
>

_____________________________________
Nikita,

please correct the start addresses your new defined memory sections.
SDRAM on the DSK is 16 Mbytes = 0x0100.0000 and starts at 0x8000.0000.
Starting at 0x8100.0000, 0x8200.0000, etc., the SDRAM contents is aliased.

the following should work:
SDRAM: org=0x80000000, len=0x00F80000
wavemem:org=0x80F80000, len=0x00020000
txtmem: org=0x80FA0000, len=0x00020000
muxmem: org=0x80FC0000, len=0x00040000

Best Regards,
Adolf Klemenz
Am 17.02.2012 16:37, schrieb nikita iyer:
> Hi all,
> I am doing a project on DSK6713 (Spectrum Digital) and using CCS V3.1 in
> which I need to interleave/mux voice input and data(for eg textual) and
> deinterleave/demux them.
> I have created sections in the external memory (SDRAM 16Mb) for storing
> the voice input, textual data and multiplexed/interleaved data.
>
> A relevant portion of the code is as follows
> ******
> /Uint16 wavbuf[50000],txtbuf[50000];/
> /Uint16 muxbuf[100000];/
> /
> /
> /#pragma DATA_SECTION(wavbuf,".wav");/
> /#pragma DATA_SECTION(muxbuf,".mux");/
> /#pragma DATA_SECTION(txtbuf,".textual");/
> /
> /
> /
> /
> /void main()/
> /{/
> / while(!feof(fpr)) //fpr points to the .txt file pointer from
> which data is to be taken/
> / {/
> /txtbuf[len++]=fgetc(fpr); //storing txt data in memory/
> / }/
> /
> /
> / for(i=0;i<20000;i++)/
> / wavbuf[i]= input_left_sample();/
> / }/
> The cmd file is as follows
>
> /MEMORY/
> /{/
> /
> /
> / IVECS: org=0h, len=0x220/
> / IRAM:org=0x00000220,len=0x0002FDE0 /*internal memory*//
> / SDRAM:org=0x80000000, len=0x01000000 /*external memory*//
> / FLASH:org=0x90000000, len=0x00020000 /*flash memory*/ /
> /wavemem:org=0x81000000,len=0x00100000/
> /txtmem: org=0x82000000,len=0x00100000/
> / muxmem: org=0x83000000,len=0x00100000 /
> /}/
> /
> /
> /SECTIONS/
> /{/
> / .wav :> wavemem/
> /.mux :> muxmem/
> /.textual :> txtmem/
> / .vectors :> IVECS/*in vector file*//
> / .text :> IRAM/*Created by C Compiler*//
> / .bss :> IRAM/
> / .cinit :> IRAM/
> / .stack :> IRAM/
> / .sysmem :> IRAM/
> / .const :> IRAM/
> / .switch :> IRAM/
> / .far :> IRAM/
> / .cio :> IRAM/
> / .csldata :> IRAM/
> /}/
> ***************
> The problem I'm facing is that when the voice input is written into the
> array wavbuf the same data is written into txtbuf (which initially
> stores the textual data properly). Thus the textual data in txtbuf gets
> overriden.
>
> I have also tried the same thing with pointers but the same thing is
> repeated.
> code snippet as follows
> *************
> /Uint16 * wavptr, * txtptr, * muxptr , * bptr; /
> /
> /
> /txtptr=&(txtbuf[0]);/
> /while(!feof(fpr)) /
> / {/
> /*(txtptr++)=fgetc(fpr); //storing txt data in memory/
> / }/
> /
> /
> /wavptr=&(wavbuf[0]);/
> / for(i=0;i<20000;i++)/
> / * (wavptr++)= input_left_sample();/
>
> *****************
> I probably have gone wrong with the sections directive or pointer
> assignment.I have also tried reversing the order i.e storing values in
> wavbuf first and then txtbuf but overwriting continues
> I have also tried creating just one section(say just SDRAM) and storing
> all arrays there. In that case, when i view the memory map,it shows the
> 2nd array (here wavbuf) at location 0x09000000(which is for FLASH memory
> I guess). Dont know why it happens Please help me with any suggestions.
>
> Thanking in advance
> Nikita Iyer
>

_____________________________________
Thanks a lot. Problem solved