Reply by simo...@telops.com November 29, 20072007-11-29
Hi,

I'm using DSP/BIOS on a C6713 with CCS 3.1.23.

I'm trying to post a swi from a task but the DSP will crash or reset itself each time. Below is a simplified version of my code. The task implements a state machine and an event posted in the task's mailbox will trigger a state change (the mailbox can be posted by different threads or HWI, not only the SWI as shown). When in state STATE_2 (3rd case statement in tsk_mytask_fnc()), I want to post my SWI, but it crashes as explained.

I first tought about a stack problem : I allocated 4kB for the task, but it still results in a crash.

I also tried to post the SWI when in state STATE_0 (first case statement), and guess what : it worked.

I tried with versions 4.90 and 5.20.05 of DSP/BIOS, with the same observed behavior.

I'm quite confused with that bug. As a workaround, I converted my SWI into a high priority TASK.

Anybody can help?

Thanks

void swi_myswi_fnc()
{
Uint32 event;

LOG_printf(&LOG0, "my swi is running");
MBX_post(&my_task_mbx, &event, 0);
}

void tsk_mytask_fnc()
{
Uint32 event;

while(1) {
MBX_pend(&my_task_mbx, &event, SYS_FOREVER);

switch (cstate)
{
case STATE_0:
// do something
cstate = STATE_1;
break;

case STATE_1:
// do something
cstate = STATE_2;
break;

case STATE_2:
// do something

swi_post(&my_swi);

cstate = STATE_3;
break;

case STATE_3:
// do something
cstate = STATE_0;
break;

default:
break;
};
}
}