2022-05-12 02:17 PM
Can anyone tell me how to activate (which function must I run) the USB if I detect a VBUS on my EXTI Interrupt.
My STM32L151 is externally Powered. I activated the SELF_POWERED function in CUBEMX.
I monitor the VBUS on an external Interrupt (rising edge). If the interrupt fires I want to activate USB. BUT I dont know how :beaming_face_with_smiling_eyes:. MX_USB_DEVICE_Init(); Seems to be already called by CUBEMX in the initialization. Which functions do I need to call? What functions do I need to STOP USB?
Thank You
2022-05-12 11:36 PM
You really don't need to do much. The STM32L1 series has an internal pullup resistor. Simply install the USB VCP as if it were powered by external power.
It would be better to put a protection element like USBLC6-2SC6 on the data line. If you plan to connect with the TYPE-C connector, you also need to connect 5K pulldown resistors to the CC pins.