DSPRelated.com
Forums

Please Solve This MEMORY PROBLEM

Started by Ashfaq Khan May 19, 2005
Hi Guys!
I am working on TMS320C6711 DSK , implementing Wavelet 2D algorithm for image processing. I have Image Resolution of about (14000 X 80 ) pixels.
 
I want to store it into onBoard SDRAM of size 16MB.
 
Before all that, i want to create a buffer of size short array [80][14000], and wana initialize it ..
But the problem is that some times at the start or some time at the end i cannt be able to initialize it problem.  I do a simple logic for initializing it using . nested FOR LOOPS.
 
I already initialize the SDRAM registers .. it works perfectly with the size of [80][80] .
 
I am attaching the Source COde and the LInKER COMMAND FILE that i use to make it possible.
 
Please , please please send me some immediate response or some tricks to handle this
 
One more thing i did to sort out the problem is that i use some delay loop after initializing the data and then i read.. after that it works perfectly
 
SOURCE CODE:
 
#include <c6x.h>
#include<string.h>
#include<stdio.h>
#include "c6211dsk.h"
#define levels 3
#define smooth_image 0
#define R 80
#define C 14000

//  *(unsigned volatile int *)IO_PORT = 0x07000000; /* Turn off all user LEDs*/
//  *(unsigned volatile int *)IO_PORT = 0x0e000000; /* Display 1 on LEDs */
//  *(unsigned volatile int *)IO_PORT = 0x0D000000; /* Display 2 on LEDs */
//  *(unsigned volatile int *)IO_PORT = 0x0C000000; /* Display 3 on LEDs */

#pragma DATA_SECTION(in_line,".imgbuf")
#pragma DATA_SECTION(out_line,".imgbuf")
#pragma DATA_SECTION(cf,".imgbuf")

short in_line[C],out_line[C];
short cf[R][C];
far short *cf1;

void main(void)
{
int i,j,lv,nx,mx,ny,my;
 
  CSR=0x100;                           /* Disable all interrupts              */
  IER=1;                               /* Disable all interrupts except NMI   */
  ICR=0xffff;                          /* Clear all pending interrupts        */
  *(unsigned volatile int *)EMIF_SDCTRL = 0x07126000; /* EMIF SDRAM control   */
  *(unsigned volatile int *)EMIF_CE0 0x30;      /* EMIF CE0 control         */
  *(unsigned volatile int *)EMIF_SDRP = 0x61A;    /* EMIF SDRM refresh period */
  *(unsigned volatile int *)EMIF_SDEXT= 0x54529;  /* EMIF SDRM extension      */
 
*(unsigned volatile int *)IO_PORT = 0x0f000000; /* DISPLAY 0  user LEDs*/
for(j=0;j<C;j++)
{
 in_line[j]=0;
 out_line[j]=0;
}

    for(i=0;i<R;i++)
    {
  cf1i];
  for(j=0;j<C;j++)
   cf1[j]2;
    } 
   
 for(i=0;i<500;i++);  
   
 if(cf[60][13999]=2)
   *(unsigned volatile int *)IO_PORT = 0x0e000000;
 else
   *(unsigned volatile int *)IO_PORT = 0x0f000000;

//*(unsigned volatile int *)IO_PORT = 0x0e000000; 
mx=R;
my=C;
while(1);
}

 
 
 
LINKER COMMAND FILE
 

MEMORY
{
 
  IRAM:       org = 0x00000220, len = 0x0000FDC0 /*internal memory*/ 
  SDRAM:      org = 0x80000000, len = 0x01000000 /*external emory*/ 
  FLASH:      org = 0x90000000, len = 0x00020000 /*flash memory*/    
}
SECTIONS
{               
  .text    :> IRAM
  .bss     :> SDRAM
  .cinit   :> IRAM
  .stack   :> IRAM
  .sysmem  :> IRAM
  .const   :> IRAM
  .switch  :> IRAM
  .far     :> IRAM
  .cio     :> IRAM
  .imgbuf  > SDRAM 
}
 
 


Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now



Ashfaq Khan <e...@yahoo.com> wrote:
Hi Guys!
I am working on TMS320C6711 DSK , implementing Wavelet 2D algorithm for image processing. I have Image Resolution of about (14000 X 80 ) pixels.
 
I want to store it into onBoard SDRAM of size 16MB.
 
Before all that, i want to create a buffer of size short array [80][14000], and wana initialize it ..
But the problem is that some times at the start or some time at the end i cannt be able to initialize it problem.  I do a simple logic for initializing it using . nested FOR LOOPS.
 
I already initialize the SDRAM registers .. it works perfectly with the size of [80][80] .
 
I am attaching the Source COde and the LInKER COMMAND FILE that i use to make it possible.
 
Please , please please send me some immediate response or some tricks to handle this
 
One more thing i did to sort out the problem is that i use some delay loop after initializing the data and then i read.. after that it works perfectly
 
SOURCE CODE:
 
#include <c6x.h>
#include<string.h>
#include<stdio.h>
#include "c6211dsk.h"
#define levels 3
#define smooth_image 0
#define R 80
#define C 14000

//  *(unsigned volatile int *)IO_PORT = 0x07000000; /* Turn off all user LEDs*/
//  *(unsigned volatile int *)IO_PORT = 0x0e000000; /* Display 1 on LEDs */
//  *(unsigned volatile int *)IO_PORT = 0x0D000000; /* Display 2 on LEDs */
//  *(unsigned volatile int *)IO_PORT = 0x0C000000; /* Display 3 on LEDs */

#pragma DATA_SECTION(in_line,".imgbuf")
#pragma DATA_SECTION(out_line,".imgbuf")
#pragma DATA_SECTION(cf,".imgbuf")

short in_line[C],out_line[C];
short cf[R][C];
far short *cf1;

void main(void)
{
int i,j,lv,nx,mx,ny,my;
 
  CSR=0x100;                           /* Disable all interrupts              */
  IER=1;                               /* Disable all interrupts except NMI   */
  ICR=0xffff;                          /* Clear all pending interrupts        */
  *(unsigned volatile int *)EMIF_SDCTRL = 0x07126000; /* EMIF SDRAM control   */
  *(unsigned volatile int *)EMIF_CE0 0x30;      /* EMIF CE0 control         */
  *(unsigned volatile int *)EMIF_SDRP = 0x61A;    /* EMIF SDRM refresh period */
  *(unsigned volatile int *)EMIF_SDEXT= 0x54529;  /* EMIF SDRM extension      */
 
*(unsigned volatile int *)IO_PORT = 0x0f000000; /* DISPLAY 0  user LEDs*/
for(j=0;j<C;j++)
{
 in_line[j]=0;
 out_line[j]=0;
}

    for(i=0;i<R;i++)
    {
  cf1i];
  for(j=0;j<C;j++)
   cf1[j]2;
    } 
   
 for(i=0;i<500;i++);  
   
 if(cf[60][13999]=2)
   *(unsigned volatile int *)IO_PORT = 0x0e000000;
 else
   *(unsigned volatile int *)IO_PORT = 0x0f000000;

//*(unsigned volatile int *)IO_PORT = 0x0e000000; 
mx=R;
my=C;
while(1);
}

 
 
 
LINKER COMMAND FILE
 

MEMORY
{
 
  IRAM:       org = 0x00000220, len = 0x0000FDC0 /*internal memory*/ 
  SDRAM:      org = 0x80000000, len = 0x01000000 /*external emory*/ 
  FLASH:      org = 0x90000000, len = 0x00020000 /*flash memory*/    
}
SECTIONS
{               
  .text    :> IRAM
  .bss     :> SDRAM
  .cinit   :> IRAM
  .stack   :> IRAM
  .sysmem  :> IRAM
  .const   :> IRAM
  .switch  :> IRAM
  .far     :> IRAM
  .cio     :> IRAM
  .imgbuf  > SDRAM 
}
 
 


Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now

NEW!  You can now post a message or access and search the archives of this group on DSPRelated.com:
http://www.dsprelated.com/groups/c6x/1.php

_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

Archives:  http://www.dsprelated.com/groups/c6x/1.php

To Post:  Send an email to c...@yahoogroups.com

Other DSP Related Groups: http://www.dsprelated.com/groups.php


Send instant messages to your online friends http://uk.messenger.yahoo.com

Send instant messages to your online friends http://uk.messenger.yahoo.com

Hello Ashfaq,
 
So with the insertion of the delay loops you have convinced yourself that your image buffers (placed in off-chip RAM, i.e. the ".imgbuf" section) are being initialized correctly? This leads me to believe that there is something wrong with how you are initializing the EMIF.
 
My suggestion to you would be to try using the CSL libraries to initialize the DSK. You might also try putting together a real simple DSP/BIOS project - I would hasten to guess then everything would work without having to use funky work arounds such as busy loops.
 
Incidentally, I thought you might like to know that I am the author of the new book Embedded Image Processing on the TMS320C6000 DSP (Examples in MATLAB and Code Composer Studio). I have an entire chapter on highly optimized C6x implementations of the 2D discrete wavelet transform, on both the C67x (floating point) and C64x (fixed point) DSPs. Moreover, I have recently added some new information on my web-site detailing how to port some of the projects on the book CD-ROM over to the DM642 EVM platform (click on the book link).
 
Regards,
 
Shehrzad Qureshi
www.squreshi.com

Ashfaq Khan <e...@yahoo.com> wrote:


Ashfaq Khan <e...@yahoo.com> wrote:
Hi Guys!
I am working on TMS320C6711 DSK , implementing Wavelet 2D algorithm for image processing. I have Image Resolution of about (14000 X 80 ) pixels.
 
I want to store it into onBoard SDRAM of size 16MB.
 
Before all that, i want to create a buffer of size short array [80][14000], and wana initialize it ..
But the problem is that some times at the start or some time at the end i cannt be able to initialize it problem.  I do a simple logic for initializing it using . nested FOR LOOPS.
 
I already initialize the SDRAM registers .. it works perfectly with the size of [80][80] .
 
I am attaching the Source COde and the LInKER COMMAND FILE that i use to make it possible.
 
Please , please please send me some immediate response or some tricks to handle this
 
One more thing i did to sort out the problem is that i use some delay loop after initializing the data and then i read.. after that it works perfectly
 
SOURCE CODE:
 
#include <c6x.h>
#include<string.h>
#include<stdio.h>
#include "c6211dsk.h"
#define levels 3
#define smooth_image 0
#define R 80
#define C 14000

//  *(unsigned volatile int *)IO_PORT = 0x07000000; /* Turn off all user LEDs*/
//  *(unsigned volatile int *)IO_PORT = 0x0e000000; /* Display 1 on LEDs */
//  *(unsigned volatile int *)IO_PORT = 0x0D000000; /* Display 2 on LEDs */
//  *(unsigned volatile int *)IO_PORT = 0x0C000000; /* Display 3 on LEDs */

#pragma DATA_SECTION(in_line,".imgbuf")
#pragma DATA_SECTION(out_line,".imgbuf")
#pragma DATA_SECTION(cf,".imgbuf")

short in_line[C],out_line[C];
short cf[R][C];
far short *cf1;

void main(void)
{
int i,j,lv,nx,mx,ny,my;
 
  CSR=0x100;                           /* Disable all interrupts              */
  IER=1;                               /* Disable all interrupts except NMI   */
  ICR=0xffff;                          /* Clear all pending interrupts        */
  *(unsigned volatile int *)EMIF_SDCTRL = 0x07126000; /* EMIF SDRAM control   */
  *(unsigned volatile int *)EMIF_CE0 0x30;      /* EMIF CE0 control         */
  *(unsigned volatile int *)EMIF_SDRP = 0x61A;    /* EMIF SDRM refresh period */
  *(unsigned volatile int *)EMIF_SDEXT= 0x54529;  /* EMIF SDRM extension      */
 
*(unsigned volatile int *)IO_PORT = 0x0f000000; /* DISPLAY 0  user LEDs*/
for(j=0;j<C;j++)
{
 in_line[j]=0;
 out_line[j]=0;
}

    for(i=0;i<R;i++)
    {
  cf1i];
  for(j=0;j<C;j++)
   cf1[j]2;
    } 
   
 for(i=0;i<500;i++);  
   
 if(cf[60][13999]=2)
   *(unsigned volatile int *)IO_PORT = 0x0e000000;
 else
   *(unsigned volatile int *)IO_PORT = 0x0f000000;

//*(unsigned volatile int *)IO_PORT = 0x0e000000; 
mx=R;
my=C;
while(1);
}

 
 
 
LINKER COMMAND FILE
 

MEMORY
{
 
  IRAM:       org = 0x00000220, len = 0x0000FDC0 /*internal memory*/ 
  SDRAM:      org = 0x80000000, len = 0x01000000 /*external emory*/ 
  FLASH:      org = 0x90000000, len = 0x00020000 /*flash memory*/    
}
SECTIONS
{               
  .text    :> IRAM
  .bss     :> SDRAM
  .cinit   :> IRAM
  .stack   :> IRAM
  .sysmem  :> IRAM
  .const   :> IRAM
  .switch  :> IRAM
  .far     :> IRAM
  .cio     :> IRAM
  .imgbuf  > SDRAM 
}
 
 


Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now

NEW!  You can now post a message or access and search the archives of this group on DSPRelated.com:
http://www.dsprelated.com/groups/c6x/1.php

_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

Archives:  http://www.dsprelated.com/groups/c6x/1.php

To Post:  Send an email to c...@yahoogroups.com

Other DSP Related Groups: http://www.dsprelated.com/groups.php


Send instant messages to your online friends http://uk.messenger.yahoo.com

Send instant messages to your online friends http://uk.messenger.yahoo.com

NEW!  You can now post a message or access and search the archives of this group on DSPRelated.com:
http://www.dsprelated.com/groups/c6x/1.php

_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

Archives:  http://www.dsprelated.com/groups/c6x/1.php

To Post:  Send an email to c...@yahoogroups.com

Other DSP Related Groups: http://www.dsprelated.com/groups.php


__________________________________________________