I have a problem to monitoring USB connexion state on STM32F7.
We try to use suspend/resume events to monitor the USB state.
The interrupt function "HAL_PCD_IRQHandler" should allow us to monitoring connexion state.
If USB is plug off, the flag "Suspend Interrupt" is up and the function "HAL_PCD_SuspendCallback" should be call.
If the USB is plug on, the flag "Resume Interrupt" is up and the function "HAL_PCD_ResumeCallback" should be call.
However in my case, the event "suspend" is called just after the initialisation, and during the plug on and plug off sequences these tow events "Suspend Interrupt" and "Resume Interrupt" are called at the same time.
At other time, the suspend event is up when the USB is plug off, but the resume event is up few seconds after, unless plug on.
To resume, the resume and suspend event are greatly trigged by the plug action, but the behavior is some unpredictable and don’t allow the monitoring of USB plug state.
There are also tow other function "HAL_PCD_ConnectCallback" and "HAL_PCD_DisconnectCallback" but there are never called.
I tried to modify the interrupt priority level, without result. I tried to startup the USB with minimal configuration values, with no more results.
I’ve read the document "STM32Cube USB device library.pdf" but I’ve not find solution for me.
What do you suggest as a solution to resolve the monitoring of the USB plug ?