DSPRelated.com
Forums

RTDX write crashes C67xx

Started by Andreas Weishaupt March 19, 2010
Hi everybody
I want to transfer data from the target to the PC. I'm working with
the OMAP-L137 EVM, but I only use the C6747 part. I've read various
sections of docs (RTDX docs, Code Composer Tutorial, DSP/BIOS user's
guide) and went through several messages on RTDX in this group.

First I've tried to write some constant data simply in the main
function (no DSP/BIOS) and then reading it in MATLAB. It was all okay.

Then I was using DSP/BIOS (simply replacing the create channel
function call by a creating a channel using the DSP/BIOS) and tried to
write some data ONCE by software interrupt. Okay again. But when I
change the RTDX configuration to continuous mode, CCS crashes.

When I try to continuously write data by ISR, I cannot halt the
processor and a dialog box appears suggesting disconnecting. CCS
indicates "disconnected (running)". If I reconnect the processor halts
and I see the event graph: it first successfully passes in the
interrupts, but then goes back into the task where it marks
"assertion" in red in the event graph.

Can anybody help me solve my problem? I really don't know what's
wrong. Last question: does there have to be some running app on the PC
other than MATLAB reading what is sent by RTDX?
The structure of my test app is something like:

// headers
// create buffer, currently size 16, but in the end I shold have
something like 2048
Void main() {}

Void taskFxn() {
SWI_post(&fillBuffer_swi);
}

Int fillBuffer(Int *buffer, Int *dummy) {
// fill buffer using a loop (just for simplicity)
SWI_post(&transferBuffer_swi);
}

Int transferBuffer(Int *dummy1, Int *dummy2) {
status = RTDX_write(&ochan, data, sizeof(data));
if (status != 0) {
LOG_printf(&trace,"RTDX write error!");
exit(-1);
}
SWI_post(&fillBuffer);
}
Thank you so much for your help

_____________________________________
Andreas,

The first problem I see is that the code is written as a recursion that never ends.

After fixing that problem. possibly by putting a loop in main() that makes two calls:
fill_buffer(), modified so it does not call transfer_buffer().
transfer_buffer(), modified so it does not call fill_buffer().

R. Williams

---------- Original Message -----------
From: Andreas Weishaupt
To: c...
Sent: Fri, 19 Mar 2010 21:04:39 +0100
Subject: [c6x] RTDX write crashes C67xx

>
>
> Hi everybody
> I want to transfer data from the target to the PC. I'm working with
> the OMAP-L137 EVM, but I only use the C6747 part. I've read various
> sections of docs (RTDX docs, Code Composer Tutorial, DSP/BIOS user's
> guide) and went through several messages on RTDX in this group.
>
> First I've tried to write some constant data simply in the main
> function (no DSP/BIOS) and then reading it in MATLAB. It was all okay.
>
> Then I was using DSP/BIOS (simply replacing the create channel
> function call by a creating a channel using the DSP/BIOS) and tried to
> write some data ONCE by software interrupt. Okay again. But when I
> change the RTDX configuration to continuous mode, CCS crashes.
>
> When I try to continuously write data by ISR, I cannot halt the
> processor and a dialog box appears suggesting disconnecting. CCS
> indicates "disconnected (running)". If I reconnect the processor halts
> and I see the event graph: it first successfully passes in the
> interrupts, but then goes back into the task where it marks
> "assertion" in red in the event graph.
>
> Can anybody help me solve my problem? I really don't know what's
> wrong. Last question: does there have to be some running app on the PC
> other than MATLAB reading what is sent by RTDX?
> The structure of my test app is something like:
>
> // headers
> // create buffer, currently size 16, but in the end I shold have
> something like 2048
> Void main() {}
>
> Void taskFxn() {
> SWI_post(&fillBuffer_swi);
> }
>
> Int fillBuffer(Int *buffer, Int *dummy) {
> // fill buffer using a loop (just for simplicity)
> SWI_post(&transferBuffer_swi);
> }
>
> Int transferBuffer(Int *dummy1, Int *dummy2) {
> status = RTDX_write(&ochan, data, sizeof(data));
> if (status != 0) {
> LOG_printf(&trace,"RTDX write error!");
> exit(-1);
> }
> SWI_post(&fillBuffer);
> }
>
> Thank you so much for your help
Hi Richard,

Thank you very much for your answer. Your completely right. How could
I have missed that I've created an infinite recursion?! I've adapted
my code and put a loop in a task which receives and sends RTDX data.
All works fine for some minutes, but then the loop stops! I don't
understand why. Here's the task function:

Void initTransfer (Void) {
Int32 retcode;

// fill buffer with ascending values. BUFLEN = 128
for (count = 0; count < BUFLEN; count++) {
data[count] = count;
}

LOG_printf(&trace, "init communication");
RTDX_enableInput(&ichan);
/* handshake, init code: 654321 */
LOG_printf(&trace, "handshaking...");
do {
RTDX_read(&ichan, &control, sizeof(control));
} while (control != 654321);

LOG_printf(&trace, "start communication");
/* continuously receive and write data */
RTDX_enableOutput(&ochan);
while(TRUE) {
// receive control from host
do {
retcode = RTDX_read(&ichan, &control, sizeof(control));
} while (retcode <= 0);
// process input buffer
for (count = 0; count < BUFLEN; count++) {
data[count] = control * count;
}
// write data buffer to host
RTDX_write(&ochan, &data, sizeof(data));
while (RTDX_writing);
}
}

After 1-3 minutes, the loop stops at the line
while (RTDX_writing);
RTDX configuration is set to continuous, 4*1024 bytes buffer.

Furthermore, I don't see any of the LOG messages until I manually halt
the program. I think it might have to do something with that but I
don't know what it is exactly and how to solve it. Could you please
help me?

Thank you very much.

Andreas
2010/3/25 Richard Williams :
> Andreas,
>
> The first problem I see is that the code is written as a recursion that
> never ends.
>
> After fixing that problem. possibly by putting a loop in main() that makes
> two calls:
> fill_buffer(), modified so it does not call transfer_buffer().
> transfer_buffer(), modified so it does not call fill_buffer().
>
> R. Williams
> ---------- Original Message -----------
> From: Andreas Weishaupt
> To: c...
> Sent: Fri, 19 Mar 2010 21:04:39 +0100
> Subject: [c6x] RTDX write crashes C67xx
>
>> Hi everybody
>> I want to transfer data from the target to the PC. I'm working with
>> the OMAP-L137 EVM, but I only use the C6747 part. I've read various
>> sections of docs (RTDX docs, Code Composer Tutorial, DSP/BIOS user's
>> guide) and went through several messages on RTDX in this group.
>>
>> First I've tried to write some constant data simply in the main
>> function (no DSP/BIOS) and then reading it in MATLAB. It was all okay.
>>
>> Then I was using DSP/BIOS (simply replacing the create channel
>> function call by a creating a channel using the DSP/BIOS) and tried to
>> write some data ONCE by software interrupt. Okay again. But when I
>> change the RTDX configuration to continuous mode, CCS crashes.
>>
>> When I try to continuously write data by ISR, I cannot halt the
>> processor and a dialog box appears suggesting disconnecting. CCS
>> indicates "disconnected (running)". If I reconnect the processor halts
>> and I see the event graph: it first successfully passes in the
>> interrupts, but then goes back into the task where it marks
>> "assertion" in red in the event graph.
>>
>> Can anybody help me solve my problem? I really don't know what's
>> wrong. Last question: does there have to be some running app on the PC
>> other than MATLAB reading what is sent by RTDX?
>> The structure of my test app is something like:
>>
>> // headers
>> // create buffer, currently size 16, but in the end I shold have
>> something like 2048
>> Void main() {}
>>
>> Void taskFxn() {
>> SWI_post(&fillBuffer_swi);
>> }
>>
>> Int fillBuffer(Int *buffer, Int *dummy) {
>> // fill buffer using a loop (just for simplicity)
>> SWI_post(&transferBuffer_swi);
>> }
>>
>> Int transferBuffer(Int *dummy1, Int *dummy2) {
>> status = RTDX_write(&ochan, data, sizeof(data));
>> if (status != 0) {
>> LOG_printf(&trace,"RTDX write error!");
>> exit(-1);
>> }
>> SWI_post(&fillBuffer);
>> }
>>
>> Thank you so much for your help
>

_____________________________________
Andreas,

You did not mention if you see theRTDX_write() messages on the PC.

Your description of the problem hints that the RTDX_write buffer is filling up on the DSP.
When the buffer gets full, without the data being consumed by the PC, then the DSP program will wait forever in the while (RTDX_writing) loop.

I'm not an expert on RTDX, but that is were I would be focusing my debug efforts, on the PC reading the RTDX data.

You may want to read:
.

In general, you will need a program running on the PC that can perform the RTDX communications.
This program will be making calls into the RTDX library on the PC.
I expect, that since the data is being sent to the target, that such a program is running on your PC.
It there the possibility that it is never reading the data[] back (or only reading a portion of the data[])?

Using RTDX_poll() in the while(RTDX_writing()) loop may allow the interrupts to occur, so you will see the log messages sooner.
perhaps like the following:
while ( RTDX_writing != NULL )
{
/* Call Poll to do data transfer */
RTDX_Poll();
}

R. Williams

---------- Original Message -----------
From: Andreas Weishaupt
To: c...
Sent: Tue, 30 Mar 2010 09:52:43 +0200
Subject: Re: [c6x] RTDX write crashes C67xx

>
>
> Hi Richard,
>
> Thank you very much for your answer. Your completely right. How could
> I have missed that I've created an infinite recursion?! I've adapted
> my code and put a loop in a task which receives and sends RTDX data.
> All works fine for some minutes, but then the loop stops! I don't
> understand why. Here's the task function:
>
> Void initTransfer (Void) {
> Int32 retcode;
>
> // fill buffer with ascending values. BUFLEN = 128
> for (count = 0; count < BUFLEN; count++) {
> data[count] = count;
> }
>
> LOG_printf(&trace, "init communication");
> RTDX_enableInput(&ichan);
> /* handshake, init code: 654321 */
> LOG_printf(&trace, "handshaking...");
> do {
> RTDX_read(&ichan, &control, sizeof(control));
> } while (control != 654321);
>
> LOG_printf(&trace, "start communication");
> /* continuously receive and write data */
> RTDX_enableOutput(&ochan);
> while(TRUE) {
> // receive control from host
> do {
> retcode = RTDX_read(&ichan, &control, sizeof(control));
> } while (retcode <= 0);
> // process input buffer
> for (count = 0; count < BUFLEN; count++) {
> data[count] = control * count;
> }
> // write data buffer to host
> RTDX_write(&ochan, &data, sizeof(data));
> while (RTDX_writing);
> }
> }
>
> After 1-3 minutes, the loop stops at the line
> while (RTDX_writing);
> RTDX configuration is set to continuous, 4*1024 bytes buffer.
>
> Furthermore, I don't see any of the LOG messages until I manually halt
> the program. I think it might have to do something with that but I
> don't know what it is exactly and how to solve it. Could you please
> help me?
>
> Thank you very much.
>