Electronic – USB3300 with TM4C129 MCU

microcontrollertexas instrumentsusb

I am using a USB3300 board with my Texas Instruments MCU (TM4C129), but there are things that I do not understand, first, when I give to the USB3300 3.3V from a voltage source, the CLKOUT pin generate a 60MHZ CLK signal, but the datasheet says:

The reset input may be asserted when the USB3300 clkout signal is not active (i.e. in the suspend state caused by asserting the SuspendM bit) but reset must only be de-asserted when the USB3300 clkout signal is active and the reset has been held asserted for a duration greater than one clkout clock cycle.

How can I assert the reset input when there is no clkout? I ask this because, just by giving to the USB3300 the voltage (3.3V) a 60MHz CLK signal is generating from the CLKOUT pin.

I am using a USB3300 USB HS board from waveshare:

References:

This is the code configuration:

    volatile uint32_t setting;   // must be volatile for reset delay loop.

SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);

USBBufferInit(&g_sTxBuffer);
USBBufferInit(&g_sRxBuffer);
USBStackModeSet(0, eUSBModeForceDevice, 0);
ulpi = 1;

if(ulpi)
{
        // Enable all the peripherals that are used by the ULPI interface.
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);

        GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_0);
        GPIOPadConfigSet(GPIO_PORTLK_BASE, GPIO_PIN_0,
                         GPIO_STRENGTH_12MA, GPIO_PIN_TYPE_STD);
        GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_0, 0);  // assert a reset on the ULPI chip.


        /*  At this point, the ULPI is in reset.  A 10ms delay should be sufficient to allow this to complete. */
        /*  The GPIO configurations happening later might take long enough, but to be safe, I'm implementing a delay. */
        for(setting = 0; setting < 1200; setting++);  // hopefully this makes a long enough pause to reset the ULPI

        // ULPI Port B pins.
        GPIOPinConfigure(GPIO_PB2_USB0STP);
        GPIOPinConfigure(GPIO_PB3_USB0CLK);
        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.
        GPIOPinConfigure(GPIO_PP2_USB0NXT);
        GPIOPinConfigure(GPIO_PP3_USB0DIR);
        GPIOPinConfigure(GPIO_PP4_USB0D7);
        GPIOPinConfigure(GPIO_PP5_USB0D6);
        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.
        GPIOPinConfigure(GPIO_PL5_USB0D5);
        GPIOPinConfigure(GPIO_PL4_USB0D4);
        GPIOPinConfigure(GPIO_PL3_USB0D3);
        GPIOPinConfigure(GPIO_PL2_USB0D2);
        GPIOPinConfigure(GPIO_PL1_USB0D1);
        GPIOPinConfigure(GPIO_PL0_USB0D0);
        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);


        // PK0 - enable the USB phy.  Could be any pin really.
        // GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_0, GPIO_PIN_0);

        //setting = USBLIB_FEATURE_ULPI_HS;

        // This function is a good read...   You should check it out for more options!
        //USBDCDFeatureSet(0, USBLIB_FEATURE_USBULPI, &setting);378823290

        ui32ULPI = USBLIB_FEATURE_ULPI_HS;
        ui32SysClock = 0;


        USBULPIEnable(USB0_BASE);                                         // Enable ULPI
        USBULPIConfig(USB0_BASE, USB_ULPI_EXTVBUS | USB_ULPI_EXTVBUS_IND);// Configure the ULPI
        USBHighSpeed(USB0_BASE, true);                                    // Enable High Speed

        USBDCDFeatureSet(0, USBLIB_FEATURE_USBULPI, &ui32ULPI);
        ULPIPowerTransceiver(USB0_BASE, true);  // necessary if OTG or host.
}
else
{
    SysCtlVCOGet(SYSCTL_XTAL_25MHZ, &ui32PLLRate);

    // maybe I should still set these pins when the ULPI is not in use??
    // GPIOPinTypeUSBAnalog(USB_PORT, USB_PINS);
}
USBDCDFeatureSet(0, USBLIB_FEATURE_CPUCLK, &ui32SysClock);
USBDCDFeatureSet(0, USBLIB_FEATURE_USBPLL, &ui32PLLRate);
USBDBulkInit(0, &g_sBulkDevice);

I do not have problems with the pin configuration, the problems begin in the commands:
ULPIPowerTransceiver(USB0_BASE, true);
and
USBDBulkInit(0, &g_sBulkDevice);

Both of them read and write on USB3300 registers, but the code get stuck on them because of a while loop that waits for the access (to the USB3300) to be completed.

Best Answer

The reset pin in ULPI transceiver is optional, you normally should not be using this. From datasheet:

Optional active high transceiver reset. This is the same as a write to the ULPI Reset, address 04h, bit 5. This does not reset the ULPI register set. This pin includes an integrated pull-down resistor to ground. If not used, this pin can be floated or connected to ground (recommended)

Regarding your concern, please note the language, "may be asserted", but "must only be de-asserted". This means that you may assert the reset ANY TIME, but must de-assert it only when the clock is in HIGH state. This means that the proper operation of RESET is guaranteed only under certain conditions, it mus be syncronous with CLOCK_OUT.

In short, don't use this signal at all, keep it LOW.