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.

ULPI for TM4C129X

Hi, 

I am  using USB3320 ULPI to use it as external USB PHY for the TM4C129XNZAD. I have done the following to configure the USB_ULPI pins :

ROM_GPIOPinConfigure(GPIO_PL0_USB0D0); // USB_D0
ROM_GPIOPinConfigure(GPIO_PL1_USB0D1); // USB_D1
ROM_GPIOPinConfigure(GPIO_PL2_USB0D2); // USB_D2
ROM_GPIOPinConfigure(GPIO_PL3_USB0D3); // USB_D3
ROM_GPIOPinConfigure(GPIO_PL4_USB0D4); // USB_D4
ROM_GPIOPinConfigure(GPIO_PL5_USB0D5); // USB_D5
ROM_GPIOPinConfigure(GPIO_PP5_USB0D6); // USB_D6
ROM_GPIOPinConfigure(GPIO_PP4_USB0D7); // USB_D7

ROM_GPIOPinConfigure(GPIO_PB2_USB0STP); // USB_ULPI_STP
ROM_GPIOPinConfigure(GPIO_PB3_USB0CLK); // USB_ULPI_CLK
ROM_GPIOPinConfigure(GPIO_PP2_USB0NXT); // USB_ULPI_NXT
ROM_GPIOPinConfigure(GPIO_PP3_USB0DIR); // USB_ULPI_DIR

HWREG(GPIO_PORTD_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
HWREG(GPIO_PORTD_BASE + GPIO_O_CR) = 0xff;
ROM_GPIOPinConfigure(GPIO_PD6_USB0EPEN); // USB EPEN
ROM_GPIOPinConfigure(GPIO_PD7_USB0PFLT); // USB PFLT

ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
ROM_GPIOPinTypeUSBDigital(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7); // USB PFEN and LFPT
ROM_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7);

//ULPI pins should be configured for 12mA drive strength to meet timings.(spma056.pdf - sec4.4)

GPIOPadConfigSet(GPIO_PORTP_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 , GPIO_STRENGTH_12MA,GPIO_PIN_TYPE_STD);
ROM_GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3 , GPIO_STRENGTH_12MA,GPIO_PIN_TYPE_STD);
// ROM_GPIOPadConfigSet(GPIO_PORTN_BASE, GPIO_PIN_0 , GPIO_STRENGTH_12MA,GPIO_PIN_TYPE_STD);
ROM_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);


ROM_GPIOPinTypeUSBDigital(GPIO_PORTL_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3| GPIO_PIN_4 | GPIO_PIN_5);
ROM_GPIOPinTypeUSBDigital(GPIO_PORTP_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5);
ROM_GPIOPinTypeUSBDigital(GPIO_PORTB_BASE, GPIO_PIN_2 | GPIO_PIN_3);

and then I use:

USBOTGFeatureSet(0, USBLIB_FEATURE_USBULPI, USBLIB_FEATURE_ULPI_HS); 

to set the USB to high speed. I noticed I need to set the data pins in digital form for the internal USB PHY to be able to talk to the external PHY. I have set the clk pin to use the external PHY's clock which is 60 MHz.

I am unable to start a connection with a phone through ULPI. ( The application works in full speed without the ULPI). Are there any other settings that I need to take care of or are there any sample code out there?

  • To give you a better idea of the pin configuration, here is the ULPI pin configuration function from the upcoming release.

    void
    USBULPIPinoutSet(void)
    {

    //
    // Enable all the peripherals that are used by the ULPI interface.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);

    //
    // 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);
    //
    // ULPI Port M pins used to control the external USB oscillator and the
    // external USB phy on the DK-TM4C129X-DPHY board.
    //
    // PM1 - Enables the USB oscillator on the DK-TM4C129X-DPHY board.
    // PM3 - Enables the USB phy on the DK-TM4C129X-DPHY board.
    //
    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTM_BASE, GPIO_PIN_1 | GPIO_PIN_3);
    ROM_GPIOPinWrite(GPIO_PORTM_BASE, GPIO_PIN_1 | GPIO_PIN_3, GPIO_PIN_1 |
                                      GPIO_PIN_3);

    }

    The main routine should have something like the following:

        //
        // Switch the USB ULPI Pins over.
        //
        USBULPIPinoutSet();

        //
        // Enable USB ULPI with high speed support.
        //
        ui32Setting = USBLIB_FEATURE_ULPI_HS;
        USBOTGFeatureSet(0, USBLIB_FEATURE_USBULPI, &ui32Setting);

        //
        // Setting the PLL frequency to zero tells the USB library to use the
        // external USB clock.
        //
        ui32PLLRate = 0;

        //
        // Tell the USB library the CPU clock and the PLL frequency. This is a
        // new requirement for TM4C129 devices.
        //
        USBHCDFeatureSet(0, USBLIB_FEATURE_CPUCLK, &ui32SysClock);
        USBHCDFeatureSet(0, USBLIB_FEATURE_USBPLL, &ui32PLLRate);

     



  • Hey guys,

    I have followed the example configuration almost exactly, but I am not receiving results. For a brief time I was experiencing hangs in my program when ULPI registers were attempted to be read.

    At this point in time, the Launchpad is able to read the ULPI registers but it has issues communicating with my PC. Upon setup of the CDC device, it seems that the computer's request for device descriptor fails. I simply want to setup the ULPI for High Speed external PHY and then use USBBufferWrite to send data over a virtual COM.

    Is my problem on the host side or device side?

    Thanks!