This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

USB Disconnect Event

Other Parts Discussed in Thread: TM4C123FH6PM

Hello everyone.

I'm on a project that needs USB connection, and I want to detect when the device is connected and disconnected.

Using the usb_dev_serial example and debugging, I can detect a connection event  in the case "USB_EVENT_CONNECTED" of the control handler function, but just one time, after I unplug the USB cable and plug it again it does not trigger anymore.

Another thing is I cannot detect a disconnect event because it never goes to the case "USB_EVENT_DISCONNECTED" in the control handler when I unplug the cable.

Does anyone knows a way I can detect both connect and disconnect events correctly?

I am using the TM4C123FH6PM microcontroller.

Thanks in advance.

  • Hello Akira

    How is the USB Device being configured. If it is being configured as

        USBStackModeSet(0, eUSBModeForceDevice, 0);
    then you would need to configure the PB0 and PB1 pads as VBUS and ID and

        USBStackModeSet(0, eUSBModeDevice, 0);

    Regards

    Amit