cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0B USB error during initialization, SOLVED by modifying your library

GPREV.1
Associate II

in usb library in the file generated by STM32CubeMx for the STM32G0B1

 * @file          : Target/usbd_conf.c

 * @version       : v3.0_Cube

 * @brief         : This file implements the board support package for the USB device library

in function void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)

line 205 you have the test

 if (( hpcd->Init.speed != USB_DRD_SPEED_FS) ) || (hpcd->Init.speed != USB_DRD_SPEED_LS))

 {

   Error_Handler();

 }

this is obviously always true, and you always go to Error_Handler

I modified the test

 if (( hpcd->Init.speed != USB_DRD_SPEED_FS) ))

 {

   Error_Handler();

 }

now it's running.

Please can you check your library and give me a better solution, I don't like to modify manufacturer library.

1 ACCEPTED SOLUTION

Accepted Solutions
KDJEM.1
ST Employee

Hello @GPREV.1​ and welcome to the Community :) ,

I have tried to reproduce this error but I didn't find any issue when I build the project with STM32CubeIDE 1.12.0, STM32CubeMx6.8.0 and STM32Cube_FW_G0_V1.6.1.

The code is well described in usbd_conf.c file

  if (hpcd->Init.speed != USBD_FS_SPEED)
  {
    Error_Handler();
  }

Could you please try to use the last firmware version of STM32CubeG0 and le last M32CubeMX.6.8.0 version.

Please let me know if the problem is solved.

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
KDJEM.1
ST Employee

Hello @GPREV.1​ and welcome to the Community :) ,

I have tried to reproduce this error but I didn't find any issue when I build the project with STM32CubeIDE 1.12.0, STM32CubeMx6.8.0 and STM32Cube_FW_G0_V1.6.1.

The code is well described in usbd_conf.c file

  if (hpcd->Init.speed != USBD_FS_SPEED)
  {
    Error_Handler();
  }

Could you please try to use the last firmware version of STM32CubeG0 and le last M32CubeMX.6.8.0 version.

Please let me know if the problem is solved.

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

GPREV.1
Associate II

M32CubeMX 6.8.0 solves this problem.

Just a remark on the new usbd_conf.c file.

There are some code changes but the header is the same as the old bad version.