CLOCK_GetSysPfdFreq does not return correct frequency for bypassed pll clock

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CLOCK_GetSysPfdFreq does not return correct frequency for bypassed pll clock

230 Views
lh_dan
Contributor III

SDK_2_12_1_MIMXRT1064xxxxA fsl_clock.c

In the function CLOCK_GetSysPfdFreq(clock_pfd_t pfd) when CLOCK_GetPllFreq() returns the frequency of the Bypass Reference Clock, the returned frequency is divided by the pfd clock divider and multiplied by 18U. For the bypass clock, this should not occur. 

uint32_t CLOCK_GetSysPfdFreq(clock_pfd_t pfd)
{
uint32_t freq = CLOCK_GetPllFreq(kCLOCK_PllSys);

switch (pfd)
{
case kCLOCK_Pfd0:
freq /= ((CCM_ANALOG->PFD_528 & CCM_ANALOG_PFD_528_PFD0_FRAC_MASK) >> CCM_ANALOG_PFD_528_PFD0_FRAC_SHIFT);
break;

case kCLOCK_Pfd1:
freq /= ((CCM_ANALOG->PFD_528 & CCM_ANALOG_PFD_528_PFD1_FRAC_MASK) >> CCM_ANALOG_PFD_528_PFD1_FRAC_SHIFT);
break;

case kCLOCK_Pfd2:
freq /= ((CCM_ANALOG->PFD_528 & CCM_ANALOG_PFD_528_PFD2_FRAC_MASK) >> CCM_ANALOG_PFD_528_PFD2_FRAC_SHIFT);
break;

case kCLOCK_Pfd3:
freq /= ((CCM_ANALOG->PFD_528 & CCM_ANALOG_PFD_528_PFD3_FRAC_MASK) >> CCM_ANALOG_PFD_528_PFD3_FRAC_SHIFT);
break;

default:
freq = 0U;
break;
}
freq *= 18U;

return freq;
}

Clock tool reference example:

lh_dan_0-1668613443289.png

 

0 Kudos
1 Reply

206 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @lh_dan,

I believe you are correct. I will pass this insight to the SDK team so they can do the adequate changes on a future release.

Thank you for reporting this issue.

 

BR,

Edwin.

0 Kudos