USB Generic HID Running Under FreeRTOS

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

USB Generic HID Running Under FreeRTOS

1,118 Views
nbgatgi
Contributor IV

We are in the process of switching our device communications from RS485 to USB for a variety of reasons.  There will be one in-endpoint and one out-endpoint.  Since our most recently released product used FreeRTOS, we intend to use it again, but the main developer is no longer with our company and not available for questions.

Have any of you used the USB stack under FreeRTOS from any of the MCUXpresso SDKs?  For the time being, I'm working with the LPCXpresso54608 development board since it has a high-speed PHY on the MCU.

I'm not concerned about receiving data as I believe there would be no interrupt until the entire packet has been received.  However, I'm wondering if any of you have experienced any issues with sending data if the USB task is not the highest priority.  Once a SEND is initiated, is it an entirely hardware transceiver function?

I am just beginning to implement the USB communication by itself so there are no conflicts, but our end product will have multiple tasks (<10) running with some being timing critical and so will require top priority.

Thanks in advance for your input!

Labels (3)
0 Kudos
2 Replies

810 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Nick:

Please refer to the distinction between the priority of a task and the priority of an interrupt

A task is a software feature that is unrelated to the hardware on which FreeRTOS is running. The priority of a task is assigned in software by the application writer. A software algorithm ( the scheduler) decides which task will be in the Running state.

Although written in software, an interrupt service routine is a hardware feature because the hardware controls which interrupt service routine will run and when. Tasks will run only when there are no interrupt service routines running, so the lowest priority interrupt will interrupt the highest priority task. There is no way for a task to preempt an interrupt service routine.

I hope it helps

Regards

Daniel

0 Kudos

810 Views
nbgatgi
Contributor IV

I am aware of the distinctions between hardware interrupt and OS task priority.  Since I'm so new to using the USB stack AND FreeRTOS, I was looking for individuals' experience/knowledge specific to the situation I explained in the original question.

Regarding the device receiving a message/packet via out-endpoint, the USB PHY does all the work for receiving the data in hardware with an interrupt being triggered once the data is received.  The point being no software polling or other OS interaction is required to received the data, but naturally software is required to deal with the data once received.

Regarding sending data via the in-endpoint, the send operation must be initiated in software.  After the initiation there are a number of calls within the stack that must occur before the data is actually sent.  Once the stack works it's way to the actual hardware send, is all the software work done other than looking for the "kStatus_USB_Success" reply?

Do I need to have the USB task at the highest OS priority?  That could be a problem in our application as we have some timing sensitive activities.

Since the HID class uses interrupt transfers (yes I know that this does not mean hardware interrupt), does the stack entirely handle the guaranteed delivery aspect of interrupt transfers, or do I need to address failed delivery in my application?  Same general question for received data.

0 Kudos