USB PLL setup values do not match

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

USB PLL setup values do not match

跳至解决方案
1,821 次查看
rex_lam
Contributor IV

After using the clock config tool on OM13098 dev board (LPC546xx), I got the following values for USB PLL.

    /*!< Set up USB PLL */
    const usb_pll_setup_t usb_pllSetup = {
        .msel = 15U,
        .nsel = 0U,
        .psel = 0U,
        .direct = false,
        .bypass = false,
        .fbsel = false,
        .inputRate = 12000000U,
    };
    CLOCK_SetUsbPLLFreq(&usb_pllSetup);                        /*!< Configure PLL to the desired value */

I expected these values to match the ones in CLOCK_EnableUsbhs0HostClock() in fsl_clock.c but they don't. Here are the values from CLOCK_EnableUsbhs0HostClock():

        usb_pll_setup_t pll_setup = { 0x3FU, 0x01U, 0x03U, false, false, false, 12000000U };

        CLOCK_SetUsbPLLFreq(&pll_setup);

Can I trust the values from the clock config tool? Is there a reason to use USB_N_DIV of 4 and USB_M_MULT of 64 in CLOCK_EnableUsbhs0HostClock()? Any advice would be greatly appreciated.

标记 (2)
0 项奖励
回复
1 解答
1,622 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Rex Lam,

Thanks for your reply.
It's Okay to select a different set of Pre-divider, Feedback-divider and Post-diver to output 48 or 96 MHz, the usb_pll_setup_t pll_setup = { 0x3FU, 0x01U, 0x03U, false, false, false, 12000000U }; just is a template.
Hope this is clear.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

7 回复数
1,622 次查看
padraig_fogarty
Contributor III

I noted the same discrepancy between the clock config tool and the source in fsl_clock.c.

Although both sets of figures may arrive at the same output clock frequency, the concern I have is that the settings in fsl_clock.c appear to set the USB PLL beyond the recommended MAX frequency in the datasheet.

So I'd like to know if it is safe to use the fsl_clock.c setting function, or do I have to implement my own copy using the values from the clock config tool?

0 项奖励
回复
1,622 次查看
rex_lam
Contributor IV

Based on the formula Fout = M*(Fin/N)/(2*P), the USB PLL is not set beyond the recommended MAX frequency (using the values in fsl_clock.c). This is what it looks like in the clock tool.

pastedImage_1.png

So it should be safe to use fsl_clock.c functions.

0 项奖励
回复
1,622 次查看
padraig_fogarty
Contributor III

Okay, yes I see that I missed the fact that the order of the psel and nsel figures is different in the auto generated code.

Thanks

0 项奖励
回复
1,622 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Rex Lam,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
According the formula, Fout = M*(Fin/N)/(2*P), Fcco = M * (Fin/N) , when  usb_pll_setup_t pll_setup = { 0x3FU, 0x01U, 0x03U, false, false, false, 12000000U };,
it's easy to get USB clock = 64*(12 MHz/2)/(2*4)= 48 MHz.
About the structure usb_pllSetup that clock config tool generates, I can't jump to the conclusion that the structure is wrong before I can get more information, so I was wondering if you share the screenshot of the clock config tool.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
1,622 次查看
rex_lam
Contributor IV

Jeremy,

Thank you for your quick response. In usb_pll_setup_t, the second field is actually psel, and the third field nsel. Therefore, the formula is

64*(12 MHz/4)/(2*2) = 48 MHz

I have attached my clock diagram. I hope this is what you are asking for. I think the final frequencies are correct, but I would like to understand why it is different than the values used in fsl_clock.c.

LPC54608_clock_config.jpg

Rex

0 项奖励
回复
1,623 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Rex Lam,

Thanks for your reply.
It's Okay to select a different set of Pre-divider, Feedback-divider and Post-diver to output 48 or 96 MHz, the usb_pll_setup_t pll_setup = { 0x3FU, 0x01U, 0x03U, false, false, false, 12000000U }; just is a template.
Hope this is clear.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,622 次查看
rex_lam
Contributor IV

Thank you Jeremy. Much appreciated.

0 项奖励
回复