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