AnsweredAssumed Answered

LPC54608 using USBPLL for USB0 ?

Question asked by Carsten Groen on Sep 29, 2017
Latest reply on Oct 4, 2017 by Carsten Groen

Hello

until now, I have used the FRO96 for USB0 clocking. I would like to be able to switch it to the USBPLL instead.

I'm having difficulties in doing this and I'm not able to find any samples in the SDK that uses the USBPLL (all examples uses FRO96)

I have the code below, any pointers to where the problem is ?

 

#ifdef USBPLL
    // Does not work
     const usb_pll_setup_t usb_pllSetup = {
        .msel = 15U,
        .nsel = 1U,
        .psel = 0U,
        .direct = false,
        .bypass = false,
        .fbsel = true,
        .inputRate = 12000000U,
    };
    CLOCK_SetUsbPLLFreq(&usb_pllSetup);

    POWER_DisablePD(kPDRUNCFG_PD_USB0_PHY); // Turn on USB Phy
    CLOCK_SetClkDiv(kCLOCK_DivUsb0Clk, 1, false);
   
    CLOCK_AttachClk(kUSB_PLL_to_USB0_CLK); // Attach USB PLL clock to USB
     
    // enable usb0 host clock
    CLOCK_EnableClock(kCLOCK_Usbhsl0);
    *((uint32_t *)(USBFSH_BASE + 0x5C)) |= USBFSH_PORTMODE_DEV_ENABLE_MASK;
    // disable usb0 host clock
    CLOCK_DisableClock(kCLOCK_Usbhsl0);
    // enable USB IP clock
    CLOCK_EnableUsbfs0DeviceClock(kCLOCK_UsbSrcUsbPll, CLOCK_GetFreq(kCLOCK_UsbPll));

#else
     // Works
     // We use the FRO for the USB clock, turn it on and set it to 96 MHz
    POWER_DisablePD(kPDRUNCFG_PD_FRO_EN); // Ensure FRO is on
    CLOCK_SetupFROClocking(96000000U); // Set up high frequency FRO output to selected frequency
   
     POWER_DisablePD(kPDRUNCFG_PD_USB0_PHY); // Turn on USB Phy
    CLOCK_SetClkDiv(kCLOCK_DivUsb0Clk, 1, false);
   
     CLOCK_AttachClk(kFRO_HF_to_USB0_CLK); // Attach FRO clock to USB
    // enable usb0 host clock
    CLOCK_EnableClock(kCLOCK_Usbhsl0);
    *((uint32_t *)(USBFSH_BASE + 0x5C)) |= USBFSH_PORTMODE_DEV_ENABLE_MASK;
    // disable usb0 host clock
    CLOCK_DisableClock(kCLOCK_Usbhsl0);
    // enable USB IP clock
    CLOCK_EnableUsbfs0DeviceClock(kCLOCK_UsbSrcFro, CLOCK_GetFreq(kCLOCK_FroHf));

#endif

Outcomes