2022-04-12 04:28 PM
Update: I found a timer1 conflict with the USB_OTG so I do think this will be resolved once I fix the timer1. I'm learning how to use STM32CubeIDE with freeRTOS to program my STM32F407 DISCO board. From my understanding, I have to call MX_USB_HOST_Process() to keep my debugger/IDE updated. Since the main loop in my main.c file is no longer called and superseded by freeRTOS, I created a defaultTask who's sole job is to call 'MX_USB_HOST_Process()'. I created a default_task.h and default_task.c file and include the usb_host.h file however I get an 'undefined reference error' when calling 'MX_USB_HOST_Process();.
Is there an example for using STM32CubeIDE with freeRTOS tasks instead of a main.c loop?
I included the default_task.c file
2022-04-19 04:29 AM
Hello @LMorr.3
You can refer to the following example provided under the F4 Firmware Package:
I hope this helps.
BeST Regards,
Walid
2023-05-16 11:34 AM - edited 2023-11-20 07:44 AM
You do not need to manually call MX_USB_HOST_Process() when using RTOS. As long as you enable USBH_USE_OS under Middleware->USB_HOST in the .ioc file, the automatic code generation should take care of it for you.
In my case, it inserted a MX_USB_HOST_Init() call into my first task. All I had to do was add an osDelay() in the for loop and USB worked just fine. I don't know where MX_USB_HOST_Process() is being called, but it must be somewhere hidden in the RTOS code.