cancel
Showing results for 
Search instead for 
Did you mean: 

Why STM32H743 USB FS doesn't work if FreeRTOS TICKLESS_IDLE enabled?

sirius506
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
sirius506
Associate III

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

View solution in original post

3 REPLIES 3
sirius506
Associate III

Tested with just released CubeMX 5.2 and CubeH7 1.4.0, but it doesn't help. USB FS doesn't work.

sirius506
Associate III

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

sirius506
Associate III

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