Hi Everyone,
I hope you can help me with an issue in USB port. I am using LPC1768 with USB API USBMSD and I need to detect when USB is connected to PC in order to make a change of context in my program. I am using MBED Studio IDE with Mbed OS 6.6.0. I am trying to use USBMSD::connect() but I don’t know very well how use this method.
Hi @JohnnyK thanks for your reply. I implemented your code but i had unexpected behavior. The program enters to “if” statement always, when i have or not the usb cable connected to pc. I have the next thread implemented.
I do not know if is something similar is possible with the LPC1768. But with Nucleo-F429ZI is possible to detect connected USB cable via PA_9 pin what is connected to VBUS .
So if it is not possible with the LPC, then you maybe can do it with 5V from USB cable as external interrupt or digital input. For safety by means of a transistor maybe.
I finally implemented pin p19 as DigitalIn and everything works well in order to detect when usb cable was connected (without interrupt). Thanks for your reply.