Hi All,
I am attempting to setup my EK-TM4C1294XL with an external USB PHY and I seem to be running into some errors. The code executes up to the last line, where it gets stuck trying to read the ULPI register (Within the function called ULPIConfigSet).
The goal of this program is to allow me to use bulk transfers to transfer data from the MCU to my PC through a virtual com port. Can anyone point me in the right direction? I have a hunch that the issue might be with my hardware connector, but I am quite sure that is not the case. Can anyone who has utilized an external PHY with Tiva C verify that my initialization is correct?
Thanks!
void USB_Initialize(uint32_t ui32PLLRate, uint32_t sysClkFrequency) { uint32_t ulpiSettings; uint32_t pllSpeed; HWREG(GPIO_PORTB_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTB_BASE + GPIO_O_CR) = 0xff; HWREG(GPIO_PORTL_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTL_BASE + GPIO_O_CR) = 0xff; HWREG(GPIO_PORTP_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTP_BASE + GPIO_O_CR) = 0xff; // Enable the USB GPIO peripherals. ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); // PP5 -> PP2, PB3, PB2, PL5 -> PL0 are used for ULPI ROM_GPIOPinConfigure(GPIO_PP5_USB0D6); ROM_GPIOPinConfigure(GPIO_PP4_USB0D7); ROM_GPIOPinConfigure(GPIO_PP3_USB0DIR); ROM_GPIOPinConfigure(GPIO_PP2_USB0NXT); ROM_GPIOPinConfigure(GPIO_PB3_USB0CLK); ROM_GPIOPinConfigure(GPIO_PB2_USB0STP); ROM_GPIOPinConfigure(GPIO_PL5_USB0D5); ROM_GPIOPinConfigure(GPIO_PL4_USB0D4); ROM_GPIOPinConfigure(GPIO_PL3_USB0D3); ROM_GPIOPinConfigure(GPIO_PL2_USB0D2); ROM_GPIOPinConfigure(GPIO_PL1_USB0D1); ROM_GPIOPinConfigure(GPIO_PL0_USB0D0); // Configure the buffer type for the pin ROM_GPIOPinTypeUSBDigital(GPIO_PORTB_BASE, GPIO_PIN_3 | GPIO_PIN_2); ROM_GPIOPinTypeUSBDigital(GPIO_PORTP_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2); ROM_GPIOPinTypeUSBDigital(GPIO_PORTL_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2| GPIO_PIN_1| GPIO_PIN_0); ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0); USBClockEnable(USB0_BASE,1,USB_CLOCK_EXTERNAL); // Enable ULPI USBULPIEnable(USB0_BASE); // Configure the ULPI USBULPIConfig(USB0_BASE, USB_ULPI_EXTVBUS | USB_ULPI_EXTVBUS_IND); // Enable High Speed USBHighSpeed(USB0_BASE, true); // Initialize the transmit and receive buffers. USBBufferInit(&g_sTxBuffer); USBBufferInit(&g_sRxBuffer); USBBufferFlush(&g_sTxBuffer); USBBufferFlush(&g_sRxBuffer); // Set the USB stack mode to Device-mode with VBUS monitoring. USBStackModeSet(0, eUSBModeDevice, 0); // Tell the USB library the CPU clock and the PLL frequency. This is a // new requirement for TM4C129 devices. ulpiSettings = USBLIB_FEATURE_ULPI_HS; pllSpeed = 0; USBDCDFeatureSet(0,USBLIB_FEATURE_USBULPI, &ulpiSettings); USBDCDFeatureSet(0, USBLIB_FEATURE_CPUCLK, &sysClkFrequency); USBDCDFeatureSet(0, USBLIB_FEATURE_USBPLL, &pllSpeed); // Pass our device information to the USB library and place the device // on the bus. USBDCDCInit(0, (tUSBDCDCDevice *)&g_sCDCDevice); //ULPIConfigSet(USB0_BASE, ULPI_CFG_HS); }