cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0B0 USB_DRD_FS Interrupt problem

Kimjunho
Associate II

hello.
Using STM32G0B0CET6
USB_DRD_FS---Host_Only_FS,
USB_HOST---Mass Storage Host Class,
FATFS---USB Disk

USB Interrupt---Enable


If you set it to the above mode and operate it, the USB is recognized only once when the power is first turned on, and the USB Mount/Unmount function does not work at all from then on.
It seems that the interrupter is activated only at the beginning of power-on and is disabled thereafter.
It works fine with stm32f401 with same configuration. What causes it?
I ask for help from experts.

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

Hi @Kimjunho 

Which clock is selected for host configuration? Could you share your software setup? your hardware configuraiton?

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.


I'm out of offce with limited access to my emails.
Happy New Year!

View solution in original post

6 REPLIES 6
Kimjunho
Associate II

Correct the typo.

STM32B0B0CET6--->STM32G0B0CET6

FBL
ST Employee

Hi @Kimjunho 

Which clock is selected for host configuration? Could you share your software setup? your hardware configuraiton?

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.


I'm out of offce with limited access to my emails.
Happy New Year!
Kimjunho
Associate II

The USB clock is 48 MHz with an external crystal oscillator of 16 MHz.
It is recognized only once when the initial power is turned on, and the USB interrupter does not operate from then on.clock_config.png

The "USBH_UserProcess" routine in usb_host.c controls the LED to determine whether the USB is inserted.

static void USBH_UserProcess (USBH_HandleTypeDef *phost, uint8_t id)
{
/* USER CODE BEGIN CALL_BACK_1 */
switch(id)
{
case HOST_USER_SELECT_CONFIGURATION:
break;

case HOST_USER_DISCONNECTION:
Appli_state = APPLICATION_DISCONNECT;
HAL_GPIO_WritePin(USB_LED_GPIO_Port, USB_LED_Pin, RESET);
break;

case HOST_USER_CLASS_ACTIVE:
Appli_state = APPLICATION_READY;
HAL_GPIO_WritePin(USB_LED_GPIO_Port, USB_LED_Pin, SET);
break;

case HOST_USER_CONNECTION:
Appli_state = APPLICATION_START;
break;

default:
break;
}
/* USER CODE END CALL_BACK_1 */
}

HI @Kimjunho sir, I have a customized STM32G0B1RCT6 board, and I'm trying to use its USB host function to connect to a flash drive. I used the file handling function to create a text file and store text files from the controller to the USB. I tried the same steps on the STM32F429I-DISC1 board, and it worked well. However, it's not working on my G0B1RCT6 customized board. Why is this happening, and how can I interface the USB host with the STM32G0B1RCT6 Controller?.

I tried your method ,

>  case HOST_USER_DISCONNECTION:
    Appli_state = APPLICATION_DISCONNECT;
   HAL_GPIO_WritePin(USB_LED_GPIO_Port, USB_LED_Pin, RESET);
   break;

   case HOST_USER_CLASS_ACTIVE: 
   Appli_state = APPLICATION_READY;
   HAL_GPIO_WritePin(USB_LED_GPIO_Port, USB_LED_Pin, SET);
   break;

 and configured PB4 as an output, which is connected to a green LED. Whenever I plug in the USB to my controller, the green light appears, and whenever I remove the USB from the controller, the green light turns off.

USB Mount/Unmount function does not work . how can i solve this problem?