2019-04-21 08:09 PM
I'm having a problem to make USB CDC device driver work with FreeRTOS. If FreeRTOS is configured without TICKLESS_IDLE mode, USB CDC works fine. However, once TICKLESS_IDLE is enabled (or WFI is executed), I no longer able to finish USB enumeration process. It looks I can't get EP0 interrupt which indicates arrival of incoming SETUP packet. Why?
My code is generated by attached CubeMX configs, then main loop is modified to make it sure that FreeRTOS idle task runs.
void StartDefaultTask(void const * argument)
{
/* init code for USB_DEVICE */
MX_USB_DEVICE_Init();
/* USER CODE BEGIN 5 */
HAL_PWREx_EnableUSBVoltageDetector();
/* Infinite loop */
for(;;)
{
osDelay(10);
}
/* USER CODE END 5 */
}
I have checked RCC_AHB1LPENR settings, but USBOTG clocks are enabled.
I also tested similar configuration on STM32F767 and confirmed that USB CDC works with TICKLESS_IDLE mode enabled. That is, I imagine there is a some settings missing specific for H7, but I can't find it.
Does anyone have similar experience?
Toshiharu
Solved! Go to Solution.
2019-06-18 05:45 PM
Got following answer from ST support, and it solved my problem.
>_HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE(); fixes the problem.
>This macro is a function to clear the 28th bit of the RCC_AHB1LPENR register: USB2OTGHSULPILPEN.
>This bit is set by default to 1 after reset and should be cleared to fix the issue you reported.
Toshiharu
2019-04-24 06:00 AM
Tested with just released CubeMX 5.2 and CubeH7 1.4.0, but it doesn't help. USB FS doesn't work.
2019-04-24 06:46 PM
I've got a STM32H743-EVAL for testing purpose and configured both USB HS and FS ports as device port. Please find attached CubeMX ico file.
I confirmed that HS port works fine even when TICKLESS_IDLE is enabled and WFI instruction is executed. But FS port does NOT. I can tell something is wrong with FS driver or hardware.
Can anyone from ST confirm the problem, please?
Toshiharu
2019-06-18 05:45 PM
Got following answer from ST support, and it solved my problem.
>_HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE(); fixes the problem.
>This macro is a function to clear the 28th bit of the RCC_AHB1LPENR register: USB2OTGHSULPILPEN.
>This bit is set by default to 1 after reset and should be cleared to fix the issue you reported.
Toshiharu