USB Device Task priority under MQX?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB Device Task priority under MQX?

546 Views
brucedrumm
Contributor I

When running the HID keyboard example for the freedom K22 board the "Device Task" is given a priority 13. Per AN3905, I was under the impression that these types of system tasks were given priorities 0 - 8 and that creation of user tasks with higher priority numbers would assure that system tasks would continue to execute. In usb_dev.c the task is created using USB_DEVICE_TASK_PRIORITY which is defined as 6, but then the task creation goes through the OSA layer for MQX which adds 7 (presumably to prevent conflicts with system tasks), resulting in a priority of 13. Is this what is intended?

The reason I'm asking is that I created a long running task at priority 12 and it prevented enumeration by blocking the device task. What priority do I need to set user tasks to in order to be assured that no system tasks are blocked?

0 Kudos
2 Replies

315 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Drumm:

Yes, you are right.  USB_DEVICE_TASK_PRIORITY is the priority from user perspective, OSA  needs to adjust the value to prevent conflicts according to a specific RTOS. For mqx, it adds 7.

I suggest you display the "task summary", from which you can know how many tasks exist in your system, and their priority. Then you can set the right priority of the user tasks

Regards

Daniel

0 Kudos

315 Views
brucedrumm
Contributor I

I guess my point was that "Device Task" is a system task created internally by the USB stack during the KSDK API call USB_Class_HID_Init(),
and that per AN3905 system tasks were supposed to be assigned priorities 0-8

I was hoping that there would be some assurance that if the user creates a task of, say, priority 15 or (numerically) higher that it would not interfere with system operations.

It sounds like what you're saying is that it is the user's responsibility to keep track of all system tasks to make sure that there is no conflict.

0 Kudos