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.

TM4C123GH6Pm USB connected and disconnected even

Other Parts Discussed in Thread: TM4C123GH6PM, EK-TM4C123GXL

Hello,

I have written a code for TM4C123GH6Pm to transfer data over USB.

It is working fine but I have difficulties to detect whether the device is connected to host computer or not.

the first time that I ma connecting the device to computer USB_EVENT_CONNECTED  event happens. But if disconnect and connected it again, it is not happening.

This is the initialization of the USB:

ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5 | GPIO_PIN_4);

GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1); // ID+VBUS
// Not configured initially.
//
g_bUSBConfigured = false;

//
// Enable the UART that we will be redirecting.
//
ROM_SysCtlPeripheralEnable(USB_UART_PERIPH);


//
// Initialize the transmit and receive buffers.
//
USBBufferInit(&g_sTxBuffer);
USBBufferInit(&g_sRxBuffer);

//
// Set the USB stack mode to Device mode with VBUS monitoring.
//
USBStackModeSet(0, eUSBModeForceDevice, 0);

//
// Pass our device information to the USB library and place the device
// on the bus.
//
USBDCDCInit(0, &g_sCDCDevice);

Also I changed eUSBModeForceDevice, to eUSBModeDevice, and USB stopped working.

Is there any solution?

Thanks