cancel
Showing results for 
Search instead for 
Did you mean: 

Application Freezes when USB is connected

AfjSpi
Associate II

I am using a STM32F746NG which I am attempting to use the STM32_USB_Host_Library. I am able to initialise and start the process fine, but as soon as I connect a USB device to the port the program freezes.

I am unsure if the issue is to do with the configuration of the "STM32_USB_Host_Library" or if the issue is to do with the configuration of "STM32F7xx_HAL_Driver". I have found however that the application won't freeze if I comment out the following line from "stm32f7xx_ll_usb.c" (Although then the app won't work)

HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx)
{
 //DISABLING THIS LINE STOPS FREEZING	
  USBx->GAHBCFG |= USB_OTG_GAHBCFG_GINT;
  return HAL_OK;
}

Does anyone know why this may happen? Or where the kind of area to look for what happens when the USB connects to see if I can track down further what the actual issue is.

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
S.Ma
Principal

Look at a otg disco code example to compare, or check the reference manual... to find out for notes and warnings or bug in schematics. Maybe the ISR used to release a pending interrupt has bug

View solution in original post

5 REPLIES 5
S.Ma
Principal

Look at a otg disco code example to compare, or check the reference manual... to find out for notes and warnings or bug in schematics. Maybe the ISR used to release a pending interrupt has bug

AfjSpi
Associate II

Hi @S.Ma​ 

Thanks for your reply. I have a working example on the STM32F746G-DISCO board that I am attempting to copy over into my code.

By the reference manual are you referring to this?

https://www.st.com/content/ccc/resource/technical/document/user_manual/b8/5a/28/c2/cf/b6/47/d6/DM00105256.pdf/files/DM00105256.pdf/jcr:content/translations/en.DM00105256.pdf

Thanks Again

S.Ma
Principal

The sTM32 reference manual which describe the peripheral. The datasheet gives absoolute info such as pinout package memory mapping, etc... Looking at the USB Host HW registers might include extra info.

Compare your code with tested working example. Find where the labels are defined in the reference code and then compare with the second project. BSP (board specific) labels seems missing, maybe because the board define in the project compile option is missing and part of the H file is no longer included.

AfjSpi
Associate II

@S.Ma​ Okay thank you for your help, I shall continue looking.

AfjSpi
Associate II

@S.Ma​  You were absolutely correct, it was an issue where I wasn't handling the interrupt code. Thanks for all your help