This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc1125 rf frequency calculation problem

hi sir,

          we have a problem on calculating rf radio frequency from the FREQ [2:0] registers,

this is my code for read rf frequency,,

float readCC112xRfFreq()
{
union
{
unsigned long int longval;
unsigned char charval[4];
}Lv;

cc112xSpiReadReg(CC112X_FREQ2,&Lv.charval[2],1);
cc112xSpiReadReg(CC112X_FREQ1,&Lv.charval[1],1);
cc112xSpiReadReg(CC112X_FREQ0,&Lv.charval[0],1);
Lv.charval[3]=0;
float fvco= (float) (((float) Lv.longval/(float) TWO_POW_16)*RF_FXOSC);
float rfFreq= fvco/(float)RF_LO_DIVIDER_868;
return rfFreq;
}

/****************************************************************************

the freq [2:0] reg write value

Write_cc112x(CC112X_FREQ2 ,0x56 ); //Frequency Configuration [23:16]*/
Write_cc112x(CC112X_FREQ1 ,0xFE ); //Frequency Configuration [15:8]*/
Write_cc112x(CC112X_FREQ0 ,0x00 ); //Frequency Configuration [15:8]*/FREQ0

***********************************************************************************/

i can able to read back the above freq[2:0] values  56,FE,00

but the function  float readCC112xRfFreq() give the wrong value ,then i debugged 

the value of Lv.longval is wrong not he expected value for 869.2224Mhz

i had worked out on excel sheet in the attachment

 

 

 

 

rf calc.xlsx