DSPRelated.com
Forums

Re: Re: C6713 and DAC8581EVM interfacing Urgent help needed please !!

Started by Jeff Brower August 4, 2009
Kamran-
> I think there is some confusion in explaining the problem. I am sorry for this. In
> short, the issue is that, the attached sample code is complied and built without
> any error or warning but there is no DAC output.
>

That is meaningless. It happens all the time that code compiles and builds fine but
doesn't run correctly. Just because it's a TI code example means very little -- it
could be anything wrong: something in your project settings, something in your
hardware, even something not correct in what TI gave you. When code isn't working
you have a bug, and then you need to debug -- which is hard and tedious work, the
not-so-glamorous part of engineering. Which you seem unwilling to do.

Can't you use single-step and breakpoints to see what the code is doing? If you
don't know what are those terms, you should learn ASAP. Do some debug and find out
how far the code gets in main.c and then report back.

-Jeff
> The main concern is that, this code sample is provided by TI support center and I
> am using all the hardware and software settings as told by them so normally there
> should be some output (Snapshots of all the settings are given in the attached
> file). My query is that am I missing some important thing/step or there is some
> flaw in the code itself!!
>
> Secondly, What is basic purpose of exposed function? How the exposed function “
> DAC8581_getFinishedBufferParams()as described in the DAC8581_dsk6713.html in the
> project folder ) will be used in this case.
>
> - Kamran
>
> I am not the group, please don't post to me. Post to the group -- you should ask
> yourself why the e-mail address
> "C..." contains the word "group". Also for me personally, my job
> does not permit me to provide tech
> advice to unsolicited or non-contractual inquiries -- exceptions being online
> forums and tech groups. I'm sure other
> companies have this policy also.
>
> My comment about lack of group response: when I see someone say "please look over
> my code" I tend to think "uh oh, I
> have to find the *the problem and the answer*, not just the answer" or even worse
> "he/she wants someone to do their
> project for them". It's your job to find a specific bug or something that not's
> happening correctly, explain in
> detail the problem, your test conditions and results, and maybe give a small
> snippet of source code, preferably justa
> few lines. Then it's easier for group members to help you.
>
> In this case, you say "I guess there is some flaw in main.c". What? What is the
> first specific thing that goes
> wrong? How far does the code run? What is the first line of code that appears not
> to work? Those type of questions
> are not DSP specific -- they apply to any C/C++ code environment, on any type of
> CPU.
>
> -Jeff
>
> > I am using
> > TMS320C6713, 5-6 K interface board and DAC 8581EVM to generate high frequency
> > signals up to 1 Mhz. Currently I am using CCS V3.1 but I can switch to CCS
> > V3.3, if required. Few days ago I posted
> > some queries pertinent to my project on the group and got some helpful replies.
> > I also contacted TI support for this purpose and they sent me a sample code.
> > Currently the issue is that even that sample code is not running. I guess there
> > is some flaw in “main.c” file.
> >
> > I don’t
> > wont to spam the group by posting same sort of question again and again, I
> > shall be very thankful to you, if you could please have a look at the code and
> > identify any mistake in the code or files to be included. Secondly, in “
> DAC8581_dsk6713.htm”
> > included within the project folder, TI support has talked about some “exposed
> > functions”. I don’t understand what this function is doing and what should I
> do
> > with it? I didn’t found it any where in .c or .h files.
> >
> > Please find
> > attached the sample code provided by Ti support and detailed PDF file which I
> > have created to address this issue to Ti support.
> >
> > Regards,
> >
> > Kamran
>
With the help of breakpoints and single-step I found that program
always remain with in the while(1) loop on line 14 and does not go on line 18
or afterwards. I extended the while(1) loop from line 16 to line 39 but even then it don’t work because while(iSemaphore > 0) always
remain true due to the use of iSemaphore++. Through “watch window” I checked
that the value of iSemaphore does not decrement when TransferFinished is passed
in the dc_writeblock function.

Possible
reason to use while(1) at line 14 is to achieve continues sine wave at the DAC
output but the way in which it is used doesn’t seem logical as this loop will
never break. Even if this loop is omitted at all then the program will again
stuck at every while(iSemaphore > 0) statement.

Moreover
considering the fact that this program is using interrupt (line 13) rather than
polling; I didn’t get the structure of the program and why dc_writeblock
function is used more than once.
#define BUFF_SZ (1024)
short Buffer[BUFF_SZ];
volatile int iSemaphore = 0;
void TransferFinished(void* pDac);
1. void main (void)
2. {
3. unsigned int i;
4. /* generated sine wave */
5. for (i = 0; i < BUFF_SZ; i++) {
Buffer[i] = (short)(sin(2 * 3.141592659 * i / BUFF_SZ)
* 32767.0);
1. }
2. /* connect MCBSP to daughterboard connector */
3. if ((&Dac8581_1)->serial->port == 0)
*(unsigned volatile char *)0x90080006 |= 0x01;
1. else if ((&Dac8581_1)->serial->port == 1)
*(unsigned volatile char *)0x90080006 |= 0x02;
1. /* allocate resources and put converter in power down mode */
2. if (dc_configure(&Dac8581_1) != TIDC_NO_ERR) {
dc_close(&Dac8581_1);
abort();
1. }
2. IRQ_globalEnable();
3. while(1) {
/* send buffer twice */
(void)dc_writeblock(&Dac8581_1, Buffer, BUFF_SZ,
TransferFinished);
iSemaphore++;
(void)dc_writeblock(&Dac8581_1, Buffer, BUFF_SZ,
TransferFinished);
iSemaphore++;
1. while(iSemaphore > 0);
2. }
3. /* send buffer */
4. (void)dc_writeblock(&Dac8581_1, Buffer, BUFF_SZ, TransferFinished);
5. iSemaphore++;
6. while(iSemaphore > 0);
7. /* send max value */
8. (void)dc_writesample(&Dac8581_1, 0x0000FFFFu);
9. /* send buffer */
10. (void)dc_writeblock(&Dac8581_1, Buffer, BUFF_SZ, TransferFinished);
11. iSemaphore++;
12. while(iSemaphore > 0);
13. /* free all by the software allocate resources */
14. dc_close(&Dac8581_1);
15. /* allocate resources and put converter in power down mode */
16. if (dc_configure(&Dac8581_1) != TIDC_NO_ERR) {
dc_close(&Dac8581_1);
abort();
1. }
2. /* send buffer */
3. (void)dc_writeblock(&Dac8581_1, Buffer, BUFF_SZ, TransferFinished);
4. iSemaphore++;
5. while(iSemaphore > 0);
6. /* free all by the software allocate resources */
7. dc_close(&Dac8581_1);
1. /* wait here forever ... */
2. while(1);
3. }
4. void TransferFinished(void* pDac)
5. {
6. iSemaphore--;
7. }

________________________________
From: Jeff Brower
To: Kamran Khan
Cc: c...
Sent: Tuesday, August 4, 2009 4:02:26 PM
Subject: Re: [c6x] Re: C6713 and DAC8581EVM interfacing Urgent help needed please !! [2 Attachments]

Kamran-

I think there is some confusion in explaining the
>problem. I am sorry for this. In short, the issue is that, the attached
>sample code is complied and built without any error or warning but there
>is no DAC output.

That is meaningless. It happens all the time that code compiles
and builds fine but doesn't run correctly. Just because it's a TI
code example means very little -- it could be anything wrong: something
in your project settings, something in your hardware, even something not
correct in what TI gave you. When code isn't working you have a bug,
and then you need to debug -- which is hard and tedious work, the not-so-glamorous
part of engineering. Which you seem unwilling to do.
Can't you use single-step and breakpoints to see what the code is doing?
If you don't know what are those terms, you should learn ASAP. Do
some debug and find out how far the code gets in main.c and then report
back.
-Jeff

The main concern is that, this code sample is provided
>by TI support center and I am using all the hardware and software settings
>as told by them so normally there should be some output (Snapshots of all
>the settings are given in the attached file). My query is that am I missing
>some important thing/step or there is some flaw in the code itself!!
>>Secondly, What is basic purpose of exposed function? How the exposed function
>“DAC8581_getFinishedBufferParams()â€(as described in the DAC8581_dsk6713.html
>in the project folder ) will be used in this case.
>-
>Kamran
>
>I am not the group, please don't post to me. Post to the group
>-- you should ask yourself why the e-mail address
>
>"C..."
>contains the word "group". Also for me personally, my job does not
>permit me to provide tech
>
>advice to unsolicited or non-contractual inquiries -- exceptions being
>online forums and tech groups. I'm sure other
>
>companies have this policy also.
>
>My comment about lack of group response: when I see someone say
>"please look over my code" I tend to think "uh oh, I
>
>have to find the *the problem and the answer*, not just the answer"
>or even worse "he/she wants someone to do their
>
>project for them". It's your job to find a specific bug or something
>that not's happening correctly, explain in
>
>detail the problem, your test conditions and results, and maybe give
>a small snippet of source code, preferably justa
>
>few lines. Then it's easier for group members to help you.
>
>In this case, you say "I guess there is some flaw in main.c".
>What? What is the first specific thing that goes
>
>wrong? How far does the code run? What is the first line
>of code that appears not to work? Those type of questions
>
>are not DSP specific -- they apply to any C/C++ code environment, on
>any type of CPU.
>
>-Jeff
>
>> I am using
>
>> TMS320C6713, 5-6 K interface board and DAC 8581EVM to generate high
>frequency
>
>> signals up to 1 Mhz. Currently I am using CCS V3.1 but I can switch
>to CCS
>
>> V3.3, if required. Few days ago I posted
>
>> some queries pertinent to my project on the group and got some helpful
>replies.
>
>> I also contacted TI support for this purpose and they sent me a sample
>code.
>
>> Currently the issue is that even that sample code is not running.
>I guess there
>
>> is some flaw in “main.c� file.
>
>>> I don’t
>
>> wont to spam the group by posting same sort of question again and
>again, I
>
>> shall be very thankful to you, if you could please have a look at
>the code and
>
>> identify any mistake in the code or files to be included. Secondly,
>in “DAC8581_dsk6713.htm�
>
>> included within the project folder, TI support has talked about some
>“exposed
>
>> functions�. I don’t understand what this function is doing and
>what should I do
>
>> with it? I didn’t found it any where in .c or .h files.
>
>>> Please find
>
>> attached the sample code provided by Ti support and detailed PDF
>file which I
>
>> have created to address this issue to Ti support.
>
>>> Regards,
>
>>> Kamran
Kamran,

I looked at your code.

There are a few unclear areas.

For instance. is the 4th parameter of dc_writeblock a pointer to a call back
function?
If so, then where is the prototype for that function?
I do see the function written at the end of the listing.
That function requires a parameter "void * pDAC" that is not being used withing
the function.

I did not find the dc_writeblock function described, using the TI web site (I
may have missed the definition).

However, the root of the problem seems to be that the global variable iSemaphore
is being decremented during the execution of TransferFinished()
and being incremented after the call to dc_writeblock.

(again, without the details of the use of the dc_writeblock function)
I think the sequence of events for each write should be:
iSemaphore++;
dc_writeblock(...);
while( iSemaphore > );

I am a bit surprised that the parameter 'void* pDAC' does not cause a warning
message during compile about an unused parameter.

Also, if your project is using the TI BIOS, it probably will not run correctly
as no interrupts, etc are operational until after the 'main()' function is exited.

Finally, your description of the problem strongly suggests that the
TransferFinished() function is not being called.

R. Williams
---------- Original Message -----------
From: kamran khan
To: c...
Sent: Tue, 4 Aug 2009 08:58:06 -0700 (PDT)
Subject: Re: [c6x] Re: C6713 and DAC8581EVM interfacing Urgent help needed
please !!

> With the help of breakpoints and single-step I found that program
> always remain with in the while(1) loop on line 14 and does not go on
> line 18 or afterwards. I extended the while(1) loop from line 16 to
> line 39 but even then it [UTF-8?]don’t work because while(iSemaphore > 0) always
> remain true due to the use of iSemaphore++. Through [UTF-8?]“watch
[UTF-8?]window”
> I checked that the value of iSemaphore does not decrement when
> TransferFinished is passed in the dc_writeblock function.
>
> Possible
> reason to use while(1) at line 14 is to achieve continues sine wave at
> the DAC output but the way in which it is used [UTF-8?]doesn’t seem logical
> as this loop will never break. Even if this loop is omitted at all
> then the program will again stuck at every while(iSemaphore > 0) statement.
>
> Moreover
> considering the fact that this program is using interrupt (line 13)
> rather than polling; I [UTF-8?]didn’t get the structure of the program and
> why dc_writeblock function is used more than once.
>
> #define BUFF_SZ (1024)
> short Buffer[BUFF_SZ];
> volatile int iSemaphore = 0;
> void TransferFinished(void* pDac);
> 1. void main (void)
> 2. {
> 3. unsigned int i;
> 4. /* generated sine wave */
> 5. for (i = 0; i < BUFF_SZ; i++) {
> Buffer[i] = (short)(sin(2 * 3.141592659 * i / BUFF_SZ)
> * 32767.0);
> 1. }
> 2. /* connect MCBSP to daughterboard connector */
> 3. if ((&Dac8581_1)->serial->port == 0)
> *(unsigned volatile char *)0x90080006 |= 0x01;
> 1. else if ((&Dac8581_1)->serial->port == 1)
> *(unsigned volatile char *)0x90080006 |= 0x02;
> 1. /* allocate resources and put converter in power down mode */
> 2. if (dc_configure(&Dac8581_1) != TIDC_NO_ERR) {
> dc_close(&Dac8581_1);
> abort();
> 1. }
> 2. IRQ_globalEnable();
> 3. while(1) {
> /* send buffer twice */
> (void)dc_writeblock(&Dac8581_1, Buffer, BUFF_SZ,
> TransferFinished);
> iSemaphore++;
> (void)dc_writeblock(&Dac8581_1, Buffer, BUFF_SZ,
> TransferFinished);
> iSemaphore++;
Also, the 'void TransferFinished(void* pDac)' seems to need a prototype.

> 1. while(iSemaphore > 0);
> 2. }
> 3. /* send buffer */
> 4. (void)dc_writeblock(&Dac8581_1, Buffer, BUFF_SZ, TransferFinished);
> 5. iSemaphore++;
> 6. while(iSemaphore > 0);
> 7. /* send max value */
> 8. (void)dc_writesample(&Dac8581_1, 0x0000FFFFu);
> 9. /* send buffer */
>
> 10. (void)dc_writeblock(&Dac8581_1, Buffer, BUFF_SZ, TransferFinished);
> 11. iSemaphore++;
> 12. while(iSemaphore > 0);
> 13. /* free all by the software allocate resources */
> 14. dc_close(&Dac8581_1);
> 15. /* allocate resources and put converter in power down mode */
> 16. if (dc_configure(&Dac8581_1) != TIDC_NO_ERR) {
> dc_close(&Dac8581_1); abort();
> 1. }
> 2. /* send buffer */
> 3. (void)dc_writeblock(&Dac8581_1, Buffer, BUFF_SZ, TransferFinished);
> 4. iSemaphore++;
> 5. while(iSemaphore > 0);
> 6. /* free all by the software allocate resources */
> 7. dc_close(&Dac8581_1);
> 1. /* wait here forever ... */
> 2. while(1);
> 3. }
> 4. void TransferFinished(void* pDac)
> 5. {
> 6. iSemaphore--;
> 7. }
>
> ________________________________
> From: Jeff Brower
> To: Kamran Khan
> Cc: c...
> Sent: Tuesday, August 4, 2009 4:02:26 PM
> Subject: Re: [c6x] Re: C6713 and DAC8581EVM interfacing Urgent help
> needed please !! [2 Attachments]
>
> Kamran-
>
> I think there is some confusion in explaining the
> >problem. I am sorry for this. In short, the issue is that, the attached
> >sample code is complied and built without any error or warning but there
> >is no DAC output.
>
> That is meaningless. It happens all the time that code compiles
> and builds fine but doesn't run correctly. Just because it's a TI
> code example means very little -- it could be anything wrong:
> something in your project settings, something in your hardware, even
> something not correct in what TI gave you. When code isn't working
> you have a bug, and then you need to debug -- which is hard and
> tedious work, the not-so-glamorous part of engineering. Which you
> seem unwilling to do. Can't you use single-step and breakpoints to see
> what the code is doing? If you don't know what are those terms, you
> should learn ASAP. Do some debug and find out how far the code gets
> in main.c and then report back. -Jeff
>
> The main concern is that, this code sample is provided
> >by TI support center and I am using all the hardware and software settings
> >as told by them so normally there should be some output (Snapshots of all
> >the settings are given in the attached file). My query is that am I missing
> >some important thing/step or there is some flaw in the code itself!!
> >>Secondly, What is basic purpose of exposed function? How the exposed function
> [UTF-8?]>“DAC8581_getFinishedBufferParams()â€(as described in the
DAC8581_dsk6713.html
> >in the project folder ) will be used in this case.
> >-
> >Kamran
> >
> >I am not the group, please don't post to me. Post to the group
> >-- you should ask yourself why the e-mail address
> >
> >"C..."
> >contains the word "group". Also for me personally, my job does not
> >permit me to provide tech
> >
> >advice to unsolicited or non-contractual inquiries -- exceptions being
> >online forums and tech groups. I'm sure other
> >
> >companies have this policy also.
> >
> >My comment about lack of group response: when I see someone say
> >"please look over my code" I tend to think "uh oh, I
> >
> >have to find the *the problem and the answer*, not just the answer"
> >or even worse "he/she wants someone to do their
> >
> >project for them". It's your job to find a specific bug or something
> >that not's happening correctly, explain in
> >
> >detail the problem, your test conditions and results, and maybe give
> >a small snippet of source code, preferably justa
> >
> >few lines. Then it's easier for group members to help you.
> >
> >In this case, you say "I guess there is some flaw in main.c".
> >What? What is the first specific thing that goes
> >
> >wrong? How far does the code run? What is the first line
> >of code that appears not to work? Those type of questions
> >
> >are not DSP specific -- they apply to any C/C++ code environment, on
> >any type of CPU.
> >
> >-Jeff
> >
> >> I am using
> >
> >> TMS320C6713, 5-6 K interface board and DAC 8581EVM to generate high
> >frequency
> >
> >> signals up to 1 Mhz. Currently I am using CCS V3.1 but I can switch
> >to CCS
> >
> >> V3.3, if required. Few days ago I posted
> >
> >> some queries pertinent to my project on the group and got some helpful
> >replies.
> >
> >> I also contacted TI support for this purpose and they sent me a sample
> >code.
> >
> >> Currently the issue is that even that sample code is not running.
> >I guess there
> >
> >> is some flaw in [UTF-8?]“main.c� file.
> >
> >>
> >
> >> I [UTF-8?]don’t
> >
> >> wont to spam the group by posting same sort of question again and
> >again, I
> >
> >> shall be very thankful to you, if you could please have a look at
> >the code and
> >
> >> identify any mistake in the code or files to be included. Secondly,
> >in [UTF-8?]“DAC8581_dsk6713.htm�
> >
> >> included within the project folder, TI support has talked about some
> [UTF-8?]>“exposed
> >
> >> [UTF-8?]functions�. I [UTF-8?]don’t understand what this
function is doing and
> >what should I do
> >
> >> with it? I [UTF-8?]didn’t found it any where in .c or .h files.
> >
> >>
> >
> >> Please find
> >
> >> attached the sample code provided by Ti support and detailed PDF
> >file which I
> >
> >> have created to address this issue to Ti support.
> >
> >>
> >
> >> Regards,
> >
> >>
> >
> >> Kamran
------- End of Original Message -------

_____________________________________