Other Parts Discussed in Thread: SYSBIOS
I need to call a CC3000 firmware method using a Clock or Timer. Unfortunately when I do this, I get the following error message.
ti.sysbios.knl.Semaphore: line 207: assertion failure: A_badContext: bad calling context. Must be called from a Task.
I know that I am getting this as a Clock creates a SWI thread and a Timer creates a HWI thread. Both of these threads will cause an assertion failure when a semaphore pend is called, which I believe is occurring when I call the CC3000 firmware method mdnsAdvertiser.
I have tried starting the Clock and Timer from within a Task context, but this makes no difference.
Here is my code
void mDNSSend(UArg arg0)
{
char device_name[] = "DeviceName";
if ((deviceConnected == TRUE) && (dhcpComplete == TRUE))
{
mdnsAdvertiser(1,device_name,strlen(device_name)); //This is where the assertion failure occurs
}
}
/* Timer task, I have also tried a Clock with a timeout value set, but still get the assertion */
void mDNSSendTask(UArg arg0, UArg arg1)
{
Error_Block eb;
Timer_Params timerParams;
Error_init(&eb);
Timer_Params_init(&timerParams);
timerParams.period = 200000;
timerHandle = Timer_create(Timer_ANY, mDNSSend, &timerParams, &eb);
if (timerHandle == NULL)
{
System_abort("Timer create failed");
}
}
/* mDNSSendTask is created statically in my TI-RTOS config */
/* I have also tried starting dynamically, but get the same result */
var taskParams = new Task.Params();
taskParams.instance.name = "mDNSSendTask";
taskParams.stackSize = 1024;
taskParams.priority = 4;
Program.global.wifiTask = Task.create("&mDNSSendTask", taskParams);
Is there any way I can call the mdnsAdvertiser method with a Clock or Timer?
If there is no way, then how can I call this method on a regular timed basis?
Glenn.