STM32F7 + USB HID Device + FreeRTOS

Hello Mates,

Description: I am trying to transfer the data from STM32f7 controller USB peripheral device to PC[host], when doing this in bare metal code there is no issue, but by using freeRtos i am facing issue.

Issue: The data transfer is not getting complete at all.
Is that due to parallel tasks running, what i need to implement to overcome that.

Suggestion: What are things need to be taken care any suggestion.
Do I need to use any mutex or semaphore anything else.

Clue: By using break point and debugging the code , The data transfer is getting success . I am able to send less number of bytes from PC to USB Device but not vice versa.

Looking forward for your reply, Please guide me in the right direction.


I assume that you are using one of the HAL/CDC examples provided by ST?
Note that their driver exists mostly of ISR code.
I have used them, and didn’t find any problem combining them with FreeRTOS.
Maybe this is important: I would access the CDC driver only from a single task, both for receiving as well as for sending.

Hello Hein,

Thank you for the reply.
Yes I am using HAL lib only.
I have Issue with the Touchgfx library which was creating USB data transfer Issue.

I created a new project with only FreeRTOS and checked the USB its working fine.
I doesn’t know where I doing wrong in Touchgfx project,
Any idea would be appreciated.
please point me to the solution.