DSPRelated.com
Forums

Where's the bug?

Started by Unknown March 14, 2000
Hello All,
I got the TI c6211 DSK set and tried to follow the examples that they
have and I ran into problem. I am sure many of you who has the c6211
DSK must have seen the following example.
In the TI's first example, the code is something like this:

int dotp(short *m, short *n, int count);
#include <stdio.h>
#include "data.h"
#define COUNT 256
short a[COUNT] = {A_ARRAY};
short x[COUNT] = {X_ARRAY};
volatile int y=0;
main ()
{
y=dot(a,x,COUNT);
y=dot(a,x,COUNT);
printf("y = %x hex \n",y);
printf("y = %y decimal \n",y);
}
int dotp(short *m, short *n, int count)
{
int i=0;
int product=0;
int sum=0;
for (i=0; i<count; i++)
{
product = m[i]*n[i];
sum += product;
}
return (sum);
}

In data.h, they have the array a that runs from 1 to 256
and the array x runs from 256 to 1.
The value for y is 2829056 which I got.
The problem is when I single stepped through the method dotp,
as soon as I stepped into the line which contains product=0,
both m[i] and n[i] suddenly took an a huge value and nomatter
how many times the for loop runs, the values of product and sum
are always zero (which are the initialization value). How can
this be the case. Why y has the correct value of 2829056 is even
stranger! I tried both hardware and software reset and have ran
the diagnosis test for the connections between the DSK and the
computer. Everythings looked fine except running the algorithm.
Can anyone help?

Regards
John Lai



It sounds like you have version 1.05 of Code Composer Studio for the 'C6211
DSP Starter Kit. It has a bug in the watch window.

I'm not sure if a patch has been posted to the TI website yet or not. I know
they are releasing a new version of Code Composer Studio in April. I'm sure
it'll be fixed in that.

-sgsns

>-----Original Message-----
>From:
>Sent: Tuesday, March 14, 2000 4:01 PM
>To:
>Subject: [c6x] Where's the bug? >Hello All,
>I got the TI c6211 DSK set and tried to follow the examples that they
>have and I ran into problem. I am sure many of you who has the c6211
>DSK must have seen the following example.
>In the TI's first example, the code is something like this:
>
>int dotp(short *m, short *n, int count);
>#include <stdio.h>
>#include "data.h"
>#define COUNT 256
>short a[COUNT] = {A_ARRAY};
>short x[COUNT] = {X_ARRAY};
>volatile int y=0;
>main ()
>{
> y=dot(a,x,COUNT);
> y=dot(a,x,COUNT);
> printf("y = %x hex \n",y);
> printf("y = %y decimal \n",y);
>}
>int dotp(short *m, short *n, int count)
>{
> int i=0;
> int product=0;
> int sum=0;
> for (i=0; i<count; i++)
> {
> product = m[i]*n[i];
> sum += product;
> }
> return (sum);
>}
>
>In data.h, they have the array a that runs from 1 to 256
>and the array x runs from 256 to 1.
>The value for y is 2829056 which I got.
>The problem is when I single stepped through the method dotp,
>as soon as I stepped into the line which contains product=0,
>both m[i] and n[i] suddenly took an a huge value and nomatter
>how many times the for loop runs, the values of product and sum
>are always zero (which are the initialization value). How can
>this be the case. Why y has the correct value of 2829056 is even
>stranger! I tried both hardware and software reset and have ran
>the diagnosis test for the connections between the DSK and the
>computer. Everythings looked fine except running the algorithm.
>Can anyone help?
>
>Regards
>John Lai >---------------------------------
>To Join: Send an email to
>To Post: Send an email to
>To Leave: Send an email to
>Archives: http://www.egroups.com/group/c6x
>Other Groups: http://www.dsprelated.com
______________________________________________________