cancel
Showing results for 
Search instead for 
Did you mean: 

USB and FreeRTOS in STM32L4

Rogers.Gary
Senior II

Hope someone that has implemented FreeRTOS with USB can provide advice on what specifically needs to be changed in the USB Host code to allow the USB to operate in the RTOS environment. I have USB functioning on the target board, without FreeRTOS. When I bring in FreeRTOS (using CubeMX), it breaks and does not operate. I have any user code protected in the delimited sections. I also tried in tick/tickless modes.

Why would CubeMX add in FreeRTOS and break the perfectly good USB interface? I guess CubeMX will give you one or the other, not both.

Any suggestions or references would be appreciated, thanks!

3 REPLIES 3
Rogers.Gary
Senior II

Working.

kurta999
Senior

I just use a buffer where I copy data received from USB and afterwards process it in an RTOS task, that's all. Reply can be done from task without any problem.

Rogers.Gary
Senior II

It just was not working, period. I had to do a few things - set the VBUS pin (PA9), set interrupt priorities, and finally, create the interrupt handler. I did not want Cube to do the USB setup after 3 unsuccessful attempts. Just created it manually and it now functions flawlessly.

Thanks, I understand your answer, but I do not use USB "live" in my application, all my processing starts before the scheduler starts (off-loading PRAM memory) .