sam s

USB Interface Select problem

Discussion created by sam s on Oct 15, 2012

Hi, I have M52259 with mqx 3.8

I used web_hvac example's USB part in my application;

I create some new tasks dynamically in my application. the USB part works properly before starting new tasks, but when I make my new tasks ready and run them, the usb part crashes when I detach and reattach usb stick.

I debugged it with printf and found that it crashes here:

{{{

error = _usb_hostdev_select_interface(deviceUSB.DEV_HANDLE,

  deviceUSB.INTF_HANDLE,

  (pointer) &deviceUSB.CLASS_INTF);

}}}

 

here is my task creation part:

{{{

 

 

runTaskTemplate.TASK_PRIORITY = 9;

runTaskTemplate.TASK_STACKSIZE = 2000;

runTaskTemplate.TASK_ADDRESS   = runPLCTask;

runTaskTemplate.CREATION_PARAMETER = (uint_32)tsk;

runTaskTemplate.DEFAULT_TIME_SLICE =10;

runTaskTemplate.TASK_ATTRIBUTES   =MQX_AUTO_START_TASK|MQX_TIME_SLICE_TASK;

childTaskID=_task_create_blocked(1, 0, (uint_32)&runTaskTemplate);

_sched_set_policy(childTaskID,MQX_SCHED_RR);

 

 

_taskq_suspend(my_task_queue);

 

 

/*  another task make this task ready and it continues:  */

if(runningTasks>=0){

    _task_ready(_task_get_td(/*childs.*/tasksID[0]));

 

 

 

    /****

    * Waiting for child tasks to finish

    ****/

    _taskq_suspend(my_task_queue);

}

 

}}}

 

can anybody help me?

Outcomes