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.

TM4C129 ULPI / External USB PHY usage

Hi,

I am trying to set up an external USB PHY (Microchip USB3340) on a custom TM4C129 board.
I have read some of the posts and think that I have set the pinout correctly for my custom board.
The code is below.

With this code. when I try to set ULP_HS, I hang in usb.c USBULPRegRead after calling USBDBulkInit(). The line in USBULPIRegRead is the while loop ofr "waiting for the access to complete". This never breaks out of the while loop. 

I am not sure why this is happening yet, so I have a couple of really basic questions.

Should I be using the Bulk device or the composite device here? (I used the Bulk device for full speed USB previously but that was using the built in USB, not an external PHY).

I don't want to use an external clock, I want to take the 480 MHz PLL from the MCU and then have that be divided down to 60MHz and I think that is happening ok,

I think I am taking the external PHY out of reset ok.

So I think I might be missing something basic.
Any hints please?

>>

uint32_t pllSpeed;

uint32_t ulpiSettings;

// Enable the USB GPIO peripherals.

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);

if (sleepEnable)

{

ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOB);

ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOL);

ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOP);

ROM_SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOQ);

}

//

// ULPI Port B pins.

//

ROM_GPIOPinConfigure(GPIO_PB2_USB0STP);

ROM_GPIOPinConfigure(GPIO_PB3_USB0CLK);

ROM_GPIOPinTypeUSBDigital(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3);

GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3,

GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_STD);

//

// ULPI Port P pins.

//

ROM_GPIOPinConfigure(GPIO_PP2_USB0NXT);

ROM_GPIOPinConfigure(GPIO_PP3_USB0DIR);

ROM_GPIOPinConfigure(GPIO_PP4_USB0D7);

ROM_GPIOPinConfigure(GPIO_PP5_USB0D6);

ROM_GPIOPinTypeUSBDigital(GPIO_PORTP_BASE, GPIO_PIN_2 | GPIO_PIN_3 |

GPIO_PIN_4 | GPIO_PIN_5);

GPIOPadConfigSet(GPIO_PORTP_BASE,

GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5,

GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_STD);

//

// ULPI Port L pins.

//

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);

ROM_GPIOPinTypeUSBDigital(GPIO_PORTL_BASE, GPIO_PIN_0 | GPIO_PIN_1 |

GPIO_PIN_2 | GPIO_PIN_3 |

GPIO_PIN_4 | GPIO_PIN_5);

GPIOPadConfigSet(GPIO_PORTL_BASE,

GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 |

GPIO_PIN_4 | GPIO_PIN_5,

GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_STD);

 

// Port Q

 

ROM_GPIOPinTypeUSBDigital(GPIO_PORTQ_BASE, GPIO_PIN_4);

GPIOPadConfigSet(GPIO_PORTQ_BASE, GPIO_PIN_4,

GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_STD);

ulpiSettings = USBLIB_FEATURE_ULPI_HS; // FS or HS here make USBDBulkInit hang

USBOTGFeatureSet(0, USBLIB_FEATURE_USBULPI, &ulpiSettings);

// 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. pllSpeed = 0 => use external USB clock

pllSpeed = 0;

USBDCDFeatureSet(0, USBLIB_FEATURE_CPUCLK, &clockRate);

// USBDCDFeatureSet(0, USBLIB_FEATURE_USBPLL, &pllSpeed);

// take external PHY out of reset by setting pin HIGH

ROM_GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_4, GPIO_PIN_4);

// Pass our device information to the USB library and place the device

// on the bus.

// USBDCDCInit(0, (tUSBDCDCDevice *)&g_sCDCDevice);

USBDBulkInit(0, (tUSBDBulkDevice *)&g_sBulkDevice);

  • Hello Simon

    Since it is the ULPI PHY that is not responding, I would suggest

    1. Checking that the ULPI PHY's crystal is working
    2. Make sure that the reset is driven low and then released, also add delay after the reset release.

    I have used USB3300 which has a more simpler startup mechanism

    Regards
    Amit
  • Hi,

    I managed to get the external PHY working. The issue was that the pin I was using for the reset (PQ4) needed to be configured as a GPIO Output and driven high to bring the PHY out of reset, not treated as a USB Digital as shown above. Once I made that change and toggled the stop pin, everything started working.

    Thanks,

    Simon