I’m using Tiva C series launchpad EK-TM4C1123GXL, staffed with TM4C 123GPMH MPU.
I’m trying to code USB bulk device operation. Example doesn’t work- failed to enumerate, according dmesg. So I have no chance o use provided libusb. So , I put on my glasses and start coding.
I initialize USB0 with following code. My ISR does nothing, but light BLUE LED. Guess what- no matter what I do, connect/ disconnect cable, try to enumerate device. ISR got never called, and LED was not lit.
Please direct me or hint what are my mistakes. Any help appreciated.
#define USB_PINDM GPIO_PIN_4 /* portD GPIO pin 4 GPIO_PIN_4 d-*/ #define USB_PINDP GPIO_PIN_5 /* portD GPIO pin 5 GPIO_PIN_5 d+*/ #define USB_PINID GPIO_PIN_0 /* PORTB GPIO pin 4 GPIO_PIN_0 id*/ #define USB_PINVBUS GPIO_PIN_1 /* PORTB GPIO pin 5 GPIO_PIN_1 vbus*/ //++++++++++++++++++++++++++++++++configure USB++++++++++++++++++++++++++++ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);// Signal lines while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOD)) ;;// Signal lines SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);/*/ ID,VBUS*/ while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOB));; SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);//id,vbus lines while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOB)) ;; //id,vbus lines GPIOPinTypeUSBDigital(GPIO_PORTB_BASE, (USB_PINID | USB_PINVBUS));/* ID(pin0),VBUS(pin1)*/ GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, (USB_PINDM | USB_PINDP));// Signal lines GPIOPadConfigSet(GPIO_PORTB_BASE,(USB_PINID | USB_PINVBUS),GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPD);// pull down for ID, VBUS pins USBModeConfig(USB_MODE_DEV_VBUS,0); SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); while(!SysCtlPeripheralReady(SYSCTL_PERIPH_USB0));; SysCtlUSBPLLEnable(); USBClockEnable(USB0_BASE, 7/*8*/, USB_CLOCK_INTERNAL); IntDisable(INT_USB0); USBIntDisableControl(USB0_BASE, (uint32_t)USB_INTCTRL_ALL);/*prevent interrupt by a glitch */ USBIntRegister(USB0_BASE, USB0_ISR_handle); /* REGISTER CALLBACK*/ USBIntEnableControl(USB0_BASE, USB_INTCTRL_RESET | USB_INTCTRL_DISCONNECT | USB_INTCTRL_RESUME | USB_INTCTRL_SUSPEND | USB_INTCTRL_SOF); IntEnable(INT_USB0); USBIntEnableEndpoint(USB0_BASE, USB_EP_0); USBIntEnableEndpoint(USB0_BASE, USB_EP_1);