Fix for higher frequencies : 434MHz is ok

This commit is contained in:
F5OEO 2020-07-23 15:00:04 +01:00 committed by f5oeo
parent 02599bd7f2
commit 93cf35a7ba

View file

@ -213,7 +213,15 @@ int clkgpio::SetFrequency(double Frequency)
double FloatMult=0; double FloatMult=0;
if(PllFixDivider==1) //Using PDIV thus frequency/2 if(PllFixDivider==1) //Using PDIV thus frequency/2
{
if(pi_is_2711)
FloatMult = ((double)(CentralFrequency + Frequency)*2 ) / ((double)(XOSC_FREQUENCY) * (1 - clk_ppm * 1e-6));
else
{
FloatMult = ((double)(CentralFrequency + Frequency) ) / ((double)(XOSC_FREQUENCY*2) * (1 - clk_ppm * 1e-6)); FloatMult = ((double)(CentralFrequency + Frequency) ) / ((double)(XOSC_FREQUENCY*2) * (1 - clk_ppm * 1e-6));
}
}
else else
{ {
if(pi_is_2711) if(pi_is_2711)
@ -253,7 +261,15 @@ uint32_t clkgpio::GetMasterFrac(double Frequency)
{ {
double FloatMult=0; double FloatMult=0;
if((PllFixDivider==1))//There is no Prediv on Pi4 //Using PDIV thus frequency/2 if((PllFixDivider==1))//There is no Prediv on Pi4 //Using PDIV thus frequency/2
{
if(pi_is_2711) // No PDIV on pi4
FloatMult = ((double)(CentralFrequency + Frequency) ) / ((double)(XOSC_FREQUENCY) * (1 - clk_ppm * 1e-6));
else
{
FloatMult = ((double)(CentralFrequency + Frequency) ) / ((double)(XOSC_FREQUENCY*2) * (1 - clk_ppm * 1e-6)); FloatMult = ((double)(CentralFrequency + Frequency) ) / ((double)(XOSC_FREQUENCY*2) * (1 - clk_ppm * 1e-6));
}
}
else else
{ {
if(pi_is_2711) if(pi_is_2711)
@ -432,7 +448,7 @@ int clkgpio::SetCenterFrequency(uint64_t Frequency, int Bandwidth)
} }
else else
{ {
ana[1]|=(0<<14); // No use prediv means Frequency ana[1]|=(0<<14); // No use prediv means Frequenc
} }
/* /*
* ANA register setup is done as a series of writes to * ANA register setup is done as a series of writes to