Hi All,
I wrote a code on TM4C123GH6PM which is USB host and I plug barcode reader and read like hid keyboard. Much barcode reader working very well.
But some barcode readers:
1. When I start the system with the barcode reader attached, the system receives the barcode reader as connected but does not recognize it when I remove it and plug it back in.
2. When I start the system when the barcode reader is not inserted, the same barcode reader can not detect it again.
This is my USB init code:
void initUsb(void){ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); MAP_SysCtlUSBPLLEnable(); MAP_SysCtlPeripheralEnable(PERIPH_GPIO_USB0ID); MAP_GPIOPinTypeUSBAnalog(BASE_GPIO_USB0ID, PIN_GPIO_USB0ID); MAP_SysCtlPeripheralEnable(PERIPH_GPIO_USB0VBUS); MAP_GPIOPinTypeUSBAnalog(BASE_GPIO_USB0VBUS, PIN_GPIO_USB0VBUS); MAP_SysCtlPeripheralEnable(PERIPH_GPIO_USB0DM); MAP_GPIOPinTypeUSBAnalog(BASE_GPIO_USB0DM, PIN_GPIO_USB0DM); MAP_SysCtlPeripheralEnable(PERIPH_GPIO_USB0DP); MAP_GPIOPinTypeUSBAnalog(BASE_GPIO_USB0DP, PIN_GPIO_USB0DP); MAP_GPIOPinConfigure(CONF_GPIO_USB0FLT); MAP_GPIOPinTypeUSBDigital(GPIO_PORTD_BASE, PIN_GPIO_USB0FLT); MAP_GPIOPinConfigure(CONF_GPIO_USB0EPEN); MAP_GPIOPinTypeUSBDigital(BASE_GPIO_USB0EPEN, PIN_GPIO_USB0EPEN); USBStackModeSet(0, eUSBModeForceHost, ModeCallback); USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ui32NumHostClassDrivers); g_psKeyboardInstance = USBHKeyboardOpen(KeyboardCallback, g_pui8Buffer, KEYBOARD_MEMORY_SIZE); USBHCDPowerConfigInit(0, USBHCD_VBUS_HIGH | USBHCD_FAULT_VBUS_FILTER ); USBHCDInit(0, memPoolHCD, HCDMEMORYPOOLSIZE); }