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.

LMX2592: Fnum and Fden value in TICS Pro

Part Number: LMX2592
Other Parts Discussed in Thread: TICSPRO-SW,

HI Expert,

My customer would like to set RFoutA=4928.67MHz.

They try to set each values in TICS Pro as below,

Fnum=13470000
Fden=245760000
Prescalar=2
N Divider=20

However, Fvco(MHz)=4928.67 became red.

Then, They changed the setting as below,

Fnum=449 (=13470000 / 30000)
Fden=8192 (=245760000 / 30000)
Prescalar=2
N Divider=20

Fvco(MHz)=4928.67 became white(OK).

Question1, Could you please let me know the limitation for Fnum and Fden setting? Do they need to divide by a divisible number? (In case of above condition, divide by 30000.)

Question2, If yes, this limitation is for TICS Pro only? or  it is for even If Actual use case(not use TICS Pro)?

Thanks

Muk

  • Hello Yusuke-san,

    I cannot reproduce this issue.

    This is a valid setting:

    Fnum=13470000
    Fden=245760000
    Prescalar=2
    N Divider=20

    It may be a bug on TICSPRO-SW. Please ask the customer to update to latest version available online and try again.

    Thanks,

    Vibhu

  • Vibhu-san

    Thanks for your support.

    Customer is using TICSPRO v1.7.0.0 .

    I think, It is latest version. 

    Thanks

    Muk

  • Hello Muk,

    Does the issue still exist after restarting the software?

    Thanks,

    Vibhu

  • Hi Vibhu-san,

    They try below, but, this issue is not solved.

    - Restart software

    - Uninstall TICSPRO and install it again.

    They are checking with several conditions.

    1. They found no issue with following conditions, sometimes. (however almost NG)

    Fnum=13470000
    Fden=245760000
    Prescalar=2
    N Divider=20 

    2. In case of the above setting was NG, they try to save this setting data, then they load the setting data. It may work without problems.

    3. In case of customer set below, Almost no issue. 

    Fnum=449 (=13470000 / 30000)
    Fden=8192 (=245760000 / 30000)
    Prescalar=2
    N Divider=20

    Then, when they push "Simplify Fractions" button, sometimes not work.

    Do you have any idea for the root cause of this issue?

    Thanks

    Muk

  • Hello Muk-san,

    I found a bug in the TICS Pro code that only appears in cases where PLL_NUM and PLL_DEN are both divisible by a factor of 3. The code with the bug executes immediately before the code which controls the background color of the VCO box. This is not a device configuration error, this is a TICS Pro bug. I have added this to the list of fixes for a future release.

    It makes sense that loading the data does not cause issues, since loading data does not trigger the code with the bug.

    I'm not sure I understand case 3, since 449/8192 is already the simplified fraction and the "Simplify Fraction" button shouldn't cause any update. Were there other actions taken? 

    I have tried attaching an updated version of the file to this E2E post. It may be possible for you to directly patch the bug by closing TICS Pro, copying and replacing the new file into your TICS Pro configurations folder, and reopening TICS Pro. The default place for the LMX2592 configuration files is "C:\ProgramData\Texas Instruments\TICS Pro\Configurations\Devices\PLL + VCO\LMX2592".

    LMX2592_PLL.py
    """
    Copyright (C) {2015} Texas Instruments Incorporated - http://www.ti.com/ 
    ALL RIGHTS RESERVED 
    """
    
    from System.Windows.Media import SolidColorBrush, Color, Colors
    
    from System.Windows.Controls import(ComboBox,ComboBoxItem)
    from System.Windows import TextAlignment,FontWeights
    
    import sys
    import clr
    clr.AddReference("System.Windows.Forms")
    from System.Windows.Forms import DialogResult, MessageBox, MessageBoxButtons, MessageBoxIcon
    
    import math
    brush_violation = SolidColorBrush(Color.FromArgb(255,204,0,0))
    brush_white = SolidColorBrush(Color.FromArgb(255,255,255,255))
    brush_alert = SolidColorBrush(Color.FromArgb(255,253,205,52))
    
    # Note: In some places elements are accessed using UIC_Control (UI Control Element) because of the clash with controls in User Controls Page
    
    def System_Update_Loaded_Mode():
        UpdateFpdFrequency()
        #UpdateVCOFrequency() 
        UpdateDistribution()
        UpdateVCOGain()
        UpdateCPGain()
        ValidateFrequencies()
    
    def System_Update():
        UpdateFpdFrequency()
        UpdateVCOFrequency() 
        UpdateDistribution()
        UpdateCPGain()
        ValidateFrequencies()
    
    def System_Update_Run_Once():
        UIC_Fosc_FREQ.TextAlignment = TextAlignment.Left
        UIC_Fpd_FREQ.TextAlignment = TextAlignment.Right
        UIC_CalculatedCPG.TextAlignment = TextAlignment.Left
        UIC_Fvco_FREQ.TextAlignment = TextAlignment.Left    
        UIC_VCO_MULTIPLIED_FREQ.TextAlignment = TextAlignment.Left
        UIC_CalculatedTotalDivide.TextAlignment = TextAlignment.Left
        UIC_CalculatedKvco.TextAlignment = TextAlignment.Left
        UIC_FoutA_FREQ.TextAlignment = TextAlignment.Left
        UIC_FoutB_FREQ.TextAlignment = TextAlignment.Left
    
        UpdateFpdFrequency()
        UpdateVCOFrequency() 
        UpdateDistribution()
        UpdateCPGain()
    
        UIC_OSC_2X.Background = brush_white
        UIC_PLL_R_PRE.Background = brush_white
        UIC_MULT.Background = brush_white
        UIC_PLL_R.Background = brush_white
        UIC_CP_IUP.Background = brush_white
        UIC_CP_ICOARSE.Background = brush_white
        UIC_CP_EN.Background = brush_white
        UIC_OUTA_PWR.Background = brush_white
        UIC_OUTB_PWR.Background = brush_white
        UIC_VCO_2X.Background = brush_white
        UIC_OUTA_MUX.Background = brush_white
        UIC_OUTB_MUX.Background = brush_white
        UIC_FoutA_FREQ.Background = brush_white
        UIC_FoutB_FREQ.Background = brush_white 
        UIC_PLL_N_PRE.Background = brush_white  
        UIC_CHDIV_SEG_SEL.Background = brush_white
    
        ValidateFrequencies()
         
    def CP_ICOARSE_Update():
        UpdateCPGain()
        ValidateFrequencies()
        
    def CP_EN_Update():
        UpdateCPGain()
        ValidateFrequencies()
    
    def CP_IUP_Update():
        CP_IDN.iValue=CP_IUP.iValue     #for the PLL tab, which only has IUP, to set both up and down equal
        UpdateCPGain()
        ValidateFrequencies()
    
    def UpdateCPGain():
        CP1=0
        if (CP_IUP.iValue<8):
            CP1=CP_IUP.iValue
        elif (CP_IUP.iValue<16):
            CP1=CP_IUP.iValue+8
        elif (CP_IUP.iValue<24):
            CP1=CP_IUP.iValue-8
        else:
            CP1=CP_IUP.iValue
     
        CP2=0
        if (CP_IDN.iValue<8):
            CP2=CP_IDN.iValue
        elif (CP_IDN.iValue<16):
            CP2=CP_IDN.iValue+8
        elif (CP_IDN.iValue<24):
            CP2=CP_IDN.iValue-8
        else:
            CP2=CP_IDN.iValue
    
        if (CP2<CP1):    #if CP up and down are not equal make them equal
            CP1=CP2
            
        if (CP_EN.iValue==0):
            CP1=0
     
        if (CP_ICOARSE.iValue==0):
            CPG=0.3125*CP1
        elif(CP_ICOARSE.iValue==1):
            CPG=0.3125*2*CP1
        elif (CP_ICOARSE.iValue==2):
            CPG=0.3125*1.5*CP1
        else:
            CPG=0.3125*2.5*CP1
        
        CalculatedCPG.dValue=CPG
        
    def UpdateFpdFrequency():
        R = PLL_R_PRE.iValue*PLL_R.iValue
        if (R<1):
            R=1
        Fpd = (MULT.iValue)*Fosc_FREQ.dValue/R*(1+OSC_2X.iValue)
        Fpd_FREQ.dValue=Fpd
    
    
    def UpdateNDivider():  
        Fin = Fvco_FREQ.dValue*(VCO_2X.iValue+1)
        PreN = 2*(PLL_N_PRE.iValue+1)  
        Fden = PLL_DEN.iValue
        if (Fden<1):
            Fden=1
            PLL_DEN.iValue=1
        Fpd = Fpd_FREQ.dValue
        if (Fpd<0.0000001):
            Fpd=1
            Fpd_FREQ.dValue=1
       
        FracN = Fin/Fpd/PreN
        N = math.floor(FracN)
        PLL_N.iValue = N
        PLL_NUM.iValue = round(Fden*(FracN-N))
        
        btn_LoadRegisters.Background=brush_alert
        UIC_FCAL_EN.Background=brush_alert
        btn_LoadRegisters.ToolTip="Whenever the VCO Frequency is changed from a previusly unlocked condition, the registers should be loaded."
        UIC_FCAL_EN.ToolTip="Toggling the FCAL_EN bit activates the VCO calibration.  This should be done whenever the  VCO changes to a new frequency from a previously locked frequency."
        pass
     
    def UpdateVCOFrequency():
        Fpd = Fpd_FREQ.dValue
        Fnum = PLL_NUM.iValue
        Fden = PLL_DEN.iValue    
        PreN = 2*(PLL_N_PRE.iValue+1)
        N = PLL_N.iValue
        if (Fden<1):
            Fden=1
            PLL_DEN.iValue=1
            
        FracN=1.0*N+Fnum*1.0/Fden
        Fvco = FracN*PreN*Fpd/(VCO_2X.iValue+1)
        Fvco_FREQ.dValue=round(Fvco,10)
        VCO_MULTIPLIED_FREQ.dValue = Fvco*(VCO_2X.iValue+1) 
        UpdateVCOGain() 
        
        btn_LoadRegisters.Background=brush_alert
        UIC_FCAL_EN.Background=brush_alert
        btn_LoadRegisters.ToolTip="Do this or FCAL_EN for each frequency change."
        UIC_FCAL_EN.ToolTip="Do this or LoadRegisters for each frequency change."
        
        pass 
        
    def Fosc_FREQ_Update():
        UpdateFpdFrequency()
        UpdateNDivider()
        UpdateVCOFrequency()
        UpdateDistribution()
    
    def Fosc_FREQ_Update_UI():
        ValidateFrequencies()
    
        
    def OSC_2X_Update():
        UpdateFpdFrequency()
        UpdateNDivider()
        UpdateVCOFrequency()
        UpdateDistribution()
    
    def OSC_2X_Update_UI():
        ValidateFrequencies()
       
       
    def PLL_R_PRE_Update():
        UpdateFpdFrequency()
        UpdateNDivider()
        UpdateVCOFrequency()
        UpdateDistribution()
        
    def PLL_R_PRE_Update_UI():
        ValidateFrequencies()
      
      
    def MULT_Update():
        UpdateFpdFrequency()
        UpdateNDivider()
        UpdateVCOFrequency()
        UpdateDistribution()
        
    def MULT_Update_UI():
        ValidateFrequencies()
     
     
    def PLL_R_Update():
        UpdateFpdFrequency()
        UpdateNDivider()
        UpdateVCOFrequency()
        UpdateDistribution()
    
    def PLL_R_Update_UI():
        ValidateFrequencies()    
    
        
    def Fpd_FREQ_Update():
        Fin = (OSC_2X.iValue+1)*MULT.iValue*Fosc_FREQ.dValue/PLL_R_PRE.iValue
     
        Fpd = Fpd_FREQ.dValue
        if (Fpd<0.0001):
            Fpd = Fin/PLL_R.iValue
        
        Rdiv=int(Fin/Fpd+0.5)
        if (Rdiv<1):
            Rdiv=1
        if (Rdiv>128):
            Rdiv=128    
            
        PLL_R.iValue=Rdiv
        Fpd_FREQ.dValue=Fin/PLL_R.iValue
        
        UpdateNDivider()
        UpdateVCOFrequency()
        UpdateDistribution()  
    
        
    def Fpd_FREQ_Update_UI():
        ValidateFrequencies()
        
        
    def PLL_NUM_Update():
        UpdateVCOFrequency()
        UpdateDistribution()
    
    def PLL_NUM_Update_UI():
        ValidateFrequencies()
    
        
    def PLL_DEN_Update():
        UpdateVCOFrequency()
        UpdateDistribution()
        
    def PLL_DEN_Update_UI():
        ValidateFrequencies()
    
    def PLL_N_Update():
        UpdateVCOFrequency()
        UpdateDistribution()
        
    def PLL_N_Update_UI():
        ValidateFrequencies()
        
        
    def PLL_N_PRE_Update():
        UpdateNDivider()
        UpdateVCOFrequency()
        UpdateDistribution()
    
    def PLL_N_PRE_Update_UI():
        ValidateFrequencies()
        
    def ACAL_CMP_DLY_Update_UI():
        ValidateFrequencies()    
    
    def Fvco_FREQ_Update():
        UpdateNDivider()
        UpdateVCOFrequency()
        UpdateDistribution()
        
    def Fvco_FREQ_Update_UI():
        ValidateFrequencies()
     
     
    def VCO_2X_Update():
        if (VCO_2X.iValue==1):    
            PLL_N_PRE.iValue=1
        else:
            PLL_N_PRE.iValue=0
        UpdateNDivider()
        UpdateVCOFrequency()
        UpdateDistribution()
        
        
    def VCO_2X_Update_UI():
        ValidateFrequencies()
    
        
    def FoutA_FREQ_Update():
        FoutA=FoutA_FREQ.dValue
        if (FoutA>7100):
            Fvco_FREQ.dValue=FoutA/2
            UpdateNDivider()
            VCO_2X.iValue=1
            VCO_2X_Update()
            UpdateVCOFrequency()
            OUTA_MUX.iValue=1
            CHDIV_DISTA_EN.iValue=0
            VCO_DISTA_PD.iValue=0
            UpdateDistribution()
        elif (FoutA>3549.9):
            Fvco_FREQ.dValue=FoutA
            VCO_2X.iValue=0
            VCO_2X_Update()
            UpdateNDivider()
            UpdateVCOFrequency()
            OUTA_MUX.iValue=1
            CHDIV_DISTA_EN.iValue=0
            VCO_DISTA_PD.iValue=0
            UpdateDistribution()
        elif (FoutA_FREQ.dValue<18.5):
            Fvco_FREQ.dValue=3550
            VCO_2X.iValue=0
            VCO_2X_Update()
            UpdateNDivider()
            UpdateVCOFrequency()
            OUTA_MUX.iValue=0
            CHDIV_DISTA_EN.iValue=1
            VCO_DISTA_PD.iValue=1
            CHDIV_SEG1.iValue=1
            CHDIV_SEG2.iValue=8
            CHDIV_SEG3.iValue=8
            CHDIV_SEG_SEL.iValue=4
            CHDIV_SEG_SEL_Update()
            UpdateDistribution()
        else:
            OUTA_MUX.iValue=0
            CHDIV_DISTA_EN.iValue=1
            VCO_DISTA_PD.iValue=1
            VCO_2X.iValue=0
            DivMin=3550/FoutA_FREQ.dValue
            DivMax=7100/FoutA_FREQ.dValue
            UpdateChDiv(DivMin,DivMax)
            Fvco_FREQ.dValue=CalculatedTotalDivide.dValue*FoutA_FREQ.dValue
            UpdateNDivider()
            UpdateVCOFrequency()
            CHDIV_SEG_SEL_Update()
    
    def FoutA_FREQ_Update_UI():
        ValidateFrequencies()    
        
    def FoutB_FREQ_Update():
        FoutB=FoutB_FREQ.dValue
        if (FoutB>7100):
            Fvco_FREQ.dValue=FoutB/2
            UpdateNDivider()
            VCO_2X.iValue=1
            VCO_2X_Update()
            UpdateVCOFrequency()
            OUTB_MUX.iValue=1
            CHDIV_DISTB_EN.iValue=0
            VCO_DISTB_PD.iValue=0
            UpdateDistribution()
            ValidateFrequencies()
    
        elif (FoutB>3549.9):
            Fvco_FREQ.dValue=FoutB
            VCO_2X.iValue=0
            VCO_2X_Update()
            UpdateNDivider()
            UpdateVCOFrequency()
            OUTB_MUX.iValue=1
            CHDIV_DISTB_EN.iValue=0
            VCO_DISTB_PD.iValue=0
            UpdateDistribution()
            ValidateFrequencies()
        elif (FoutB_FREQ.dValue<18.5):
            Fvco_FREQ.dValue=3550
            VCO_2X.iValue=0
            VCO_2X_Update()
            UpdateNDivider()
            UpdateVCOFrequency()
            OUTB_MUX.iValue=0
            CHDIV_DISTB_EN.iValue=1
            VCO_DISTB_PD.iValue=1
    
            CHDIV_SEG1.iValue=1
            CHDIV_SEG2.iValue=8
            CHDIV_SEG3.iValue=8
            CHDIV_SEG_SEL.iValue=4
            UpdateDistribution()
            ValidateFrequencies()
        else:
            OUTB_MUX.iValue=0
            CHDIV_DISTB_EN.iValue=1
            VCO_DISTB_PD.iValue=1
            VCO_2X.iValue=0
            DivMin=3550/FoutB_FREQ.dValue
            DivMax=7100/FoutB_FREQ.dValue
            UpdateChDiv(DivMin,DivMax)
            Fvco_FREQ.dValue=CalculatedTotalDivide.dValue*FoutB_FREQ.dValue
            UpdateNDivider()
            UpdateVCOFrequency()
            CHDIV_SEG_SEL_Update()
    
    def FoutB_FREQ_Update_UI():
        ValidateFrequencies()   
        
    def UpdateVCOGain():
        Fvco=Fvco_FREQ.dValue
        
        if (Fvco<3550):
            Kvco = 24.25
        elif (Fvco<4068):
            Kvco = 24.25+(37.20-24.25)*(Fvco-3550.0)/(4068-3550)
        elif (Fvco<4530):
            Kvco = 26.44+(38.90-26.44)*(Fvco-4068.0)/(4530-4068)        
        elif (Fvco<5008):
            Kvco = 28.27+(41.57-28.27)*(Fvco-4530.0)/(5008-4530)
        elif (Fvco<5566):
            Kvco = 32.29+(43.08-32.29)*(Fvco-5008.0)/(5566-5008)
        elif (Fvco<6062):
            Kvco = 38.37+(48.10-38.37)*(Fvco-5566.0)/(6062-5566)
        elif (Fvco<6594):
            Kvco = 44.03+(55.47-44.03)*(Fvco-6062.0)/(6594-6062)
        elif (Fvco<7100):
            Kvco = 46.84+(57.06-46.84)*(Fvco-6594.0)/(7100-6594)
        else:
            Kvco = 57.06
        CalculatedKvco.dValue=round(Kvco,1)   
     
    def CHDIV_EN_Update():
        UpdateDistribution()
        ValidateFrequencies()
    
    def CHDIV_DIST_PD_Update():
        UpdateDistribution()
        ValidateFrequencies()
        
    def CHDIV_SEG1_Update():
        UpdateDistribution()
        ValidateFrequencies()
    
    def CHDIV_SEG2_Update():
        UpdateDistribution()
        ValidateFrequencies()
    
    def CHDIV_SEG3_Update():
        UpdateDistribution()
        ValidateFrequencies()
    
    def CHDIV_SEG1_EN_Update():
        UpdateDistribution()
        ValidateFrequencies()
    
    def CHDIV_SEG2_EN_Update():
        UpdateDistribution()
        ValidateFrequencies()
    
    def CHDIV_SEG3_EN_Update():
        UpdateDistribution()
        ValidateFrequencies()
        
    def CHDIV_SEG_SEL_Update():       
        if (CHDIV_SEG_SEL.iValue==1):
            CHDIV_SEG1_EN.iValue=1
            CHDIV_SEG2_EN.iValue=0
            CHDIV_SEG3_EN.iValue=0        
        if (CHDIV_SEG_SEL.iValue==2):
            CHDIV_SEG1_EN.iValue=1
            CHDIV_SEG2_EN.iValue=1
            CHDIV_SEG3_EN.iValue=0
        if (CHDIV_SEG_SEL.iValue==4):
            CHDIV_SEG1_EN.iValue=1
            CHDIV_SEG2_EN.iValue=1
            CHDIV_SEG3_EN.iValue=1
        UpdateDistribution()
        ValidateFrequencies()
    
    
    def CHDIV_DISTA_EN_Update():
        UpdateDistribution()
        ValidateFrequencies()
    
    def CHDIV_DISTB_EN_Update():
        UpdateDistribution()
        ValidateFrequencies()
    
    def VCO_DISTA_PD_Update():
        UpdateDistribution()
        ValidateFrequencies()
    
    def VCO_DISTB_PD_Update():
        UpdateDistribution()
        ValidateFrequencies()
        
    def OUTA_MUX_Update():
        if (OUTA_MUX.iValue==0):
            VCO_DISTA_PD.iValue=1
            CHDIV_DISTA_EN.iValue=1
            CHDIV_DIST_PD.iValue=0
        else:
            VCO_DISTA_PD.iValue=0
            CHDIV_DISTA_EN.iValue=0
        UpdateDistribution()
        ValidateFrequencies() 
    
        
    def OUTA_MUX_Update_UI():
        UpdateDistribution()
        ValidateFrequencies()
        
    def OUTB_MUX_Update():
        if (OUTB_MUX.iValue==0):
            VCO_DISTB_PD.iValue=1
            CHDIV_DISTB_EN.iValue=1
            CHDIV_DIST_PD.iValue=0
        else:
            VCO_DISTB_PD.iValue=0
            CHDIV_DISTB_EN.iValue=0
        UpdateDistribution()
        ValidateFrequencies()   
    
    def OUTB_MUX_Update_UI():
        UpdateDistribution()
        ValidateFrequencies()
    
    def OUTA_PD_Update():
        if (OUTA_PD.iValue==1):
            VCO_DISTA_PD.iValue=1
            CHDIV_DISTA_EN.iValue=0
        elif (OUTA_MUX.iValue==0):
            VCO_DISTA_PD.iValue=1
            CHDIV_DISTA_EN.iValue=1 
        else:
            VCO_DISTA_PD.iValue=0
            CHDIV_DISTA_EN.iValue=0    
        UpdateDistribution()
        ValidateFrequencies()
               
    def OUTB_PD_Update():
        if (OUTB_PD.iValue==1):
            VCO_DISTB_PD.iValue=1
            CHDIV_DISTB_EN.iValue=0
        elif (OUTB_MUX.iValue==0):
            VCO_DISTB_PD.iValue=1
            CHDIV_DISTB_EN.iValue=1 
        else:
            VCO_DISTB_PD.iValue=0
            CHDIV_DISTB_EN.iValue=0  
        UpdateDistribution()
        ValidateFrequencies()
    
    def OUTA_PWR_Update():
        ValidateFrequencies()
    
    def OUTB_PWR_Update():
        ValidateFrequencies()
        
        
    
    def UpdateDistribution():      
        CalculateChDiv()
        UpdateOutMux()
        UpdatePowerSettings()
        pass
          
    def UpdateChDiv(DivMin,DivMax):     
        if (2>=DivMin) and (2<=DivMax):
            CHDIV=2
            CHDIV_SEG1.iValue=0
            CHDIV_SEG2.iValue=1
            CHDIV_SEG3.iValue=1
        elif (3>=DivMin) and (3<=DivMax):
            CHDIV=3
            CHDIV_SEG1.iValue=1
            CHDIV_SEG2.iValue=1
            CHDIV_SEG3.iValue=1
        elif (4>=DivMin) and (4<=DivMax):
            CHDIV=4 
            CHDIV_SEG1.iValue=0
            CHDIV_SEG2.iValue=1
            CHDIV_SEG3.iValue=1                
        elif (6>=DivMin) and (6<=DivMax):
            CHDIV=6    
            CHDIV_SEG1.iValue=1
            CHDIV_SEG2.iValue=1
            CHDIV_SEG3.iValue=1                
        elif (8>=DivMin) and (8<=DivMax):
            CHDIV=8
            CHDIV_SEG1.iValue=0
            CHDIV_SEG2.iValue=2
            CHDIV_SEG3.iValue=1
        elif (12>=DivMin) and (12<=DivMax):
            CHDIV=12  
            CHDIV_SEG1.iValue=0
            CHDIV_SEG2.iValue=4
            CHDIV_SEG3.iValue=1  
        elif (16>=DivMin) and (16<=DivMax):
            CHDIV=16    
            CHDIV_SEG1.iValue=0
            CHDIV_SEG2.iValue=8
            CHDIV_SEG3.iValue=1  
        elif (24>=DivMin) and (24<=DivMax):
            CHDIV=24    
            CHDIV_SEG1.iValue=1
            CHDIV_SEG2.iValue=8
            CHDIV_SEG3.iValue=1                 
        elif (32>=DivMin) and (32<=DivMax):
            CHDIV=32 
            CHDIV_SEG1.iValue=0
            CHDIV_SEG2.iValue=8
            CHDIV_SEG3.iValue=1                  
        elif (36>=DivMin) and (36<=DivMax):
            CHDIV=36
            CHDIV_SEG1.iValue=1
            CHDIV_SEG2.iValue=4
            CHDIV_SEG3.iValue=1 
        elif (48>=DivMin) and (48<=DivMax):
            CHDIV=48
            CHDIV_SEG1.iValue=1
            CHDIV_SEG2.iValue=8
            CHDIV_SEG3.iValue=1         
        elif (64>=DivMin) and (64<=DivMax):
            CHDIV=64
            CHDIV_SEG1.iValue=0
            CHDIV_SEG2.iValue=8
            CHDIV_SEG3.iValue=2  
        elif (96>=DivMin) and (96<=DivMax):
            CHDIV=96
            CHDIV_SEG1.iValue=0
            CHDIV_SEG2.iValue=8
            CHDIV_SEG3.iValue=4 
        elif (128>=DivMin) and (128<=DivMax):
            CHDIV=128
            CHDIV_SEG1.iValue=0
            CHDIV_SEG2.iValue=8
            CHDIV_SEG3.iValue=8                 
        elif (192>=DivMin) and (192<=DivMax):
            CHDIV=192               
            CHDIV_SEG1.iValue=1
            CHDIV_SEG2.iValue=8
            CHDIV_SEG3.iValue=8  
               
        if (CHDIV<4):
            CHDIV_SEG_SEL.iValue=1
        elif (CHDIV<25):
            CHDIV_SEG_SEL.iValue=2
        else:
            CHDIV_SEG_SEL.iValue=4
        
        CalculatedTotalDivide.dValue=CHDIV    
    
        
    def CalculateChDiv():
        SEG1=1
        SEG2=1
        SEG3=1
        CHDIV=1
        
    
        if (CHDIV_SEG1.iValue==0):
            SEG1=2      
        elif (CHDIV_SEG1.iValue==1):
            SEG1=3
        else:
            SEG1=1
    
    
        if (CHDIV_SEG2.iValue==8):
            SEG2=8
        elif (CHDIV_SEG2.iValue==4):
            SEG2=6
        elif (CHDIV_SEG2.iValue==2):
            SEG2=4
        elif (CHDIV_SEG2.iValue==1):
            SEG2=2
        else:
            SEG2=1
    
    
        if (CHDIV_SEG3.iValue==8):
            SEG3=8
        elif (CHDIV_SEG3.iValue==4):
            SEG3=6
        elif (CHDIV_SEG3.iValue==2):
            SEG3=4
        elif (CHDIV_SEG3.iValue==1):
            SEG3=2
        else:
            SEG3=1 
    
    
        if (CHDIV_SEG_SEL.iValue==4):         
            CHDIV=SEG1*SEG2*SEG3        
        elif (CHDIV_SEG_SEL.iValue==2):
            CHDIV=SEG1*SEG2
        else:         
            CHDIV=SEG1
    
           
        CalculatedTotalDivide.dValue=CHDIV
    
        
        
    def UpdateOutMux():
        Fin = Fvco_FREQ.dValue*(1+VCO_2X.iValue)
        Fchdiv = Fin/CalculatedTotalDivide.dValue
        if (OUTA_MUX.iValue==0):
            FoutA_FREQ.dValue=Fchdiv
        else:
            FoutA_FREQ.dValue=Fin
        if (OUTB_MUX.iValue==0):
            FoutB_FREQ.dValue=Fchdiv
        else:
            FoutB_FREQ.dValue=Fin
        pass
        
        
    def UpdatePowerSettings():  
        #   This routine Dims and UnDims Sections of the Powerdown Selection
        FoutA_PD=False
        FoutB_PD=False
        
       
        #   Do Outputs and output Mux and powerdown box
        if (OUTA_PD.iValue==1) :
            FoutA_PD=True
        if (OUTA_MUX.iValue==0) and (CHDIV_DISTA_EN.iValue==0):
            FoutA_PD=True
        if (OUTA_MUX.iValue==1) and (VCO_DISTA_PD.iValue==1):
            FoutA_PD=True
        if (FoutA_PD==True):
            Dim(FoutA_FREQ)
            Dim(OUTA_MUX)
            Dim(OUTA_PWR)
        else:
            UnDim(FoutA_FREQ)
            UIC_OUTA_MUX.Background=brush_white
            UnDim(OUTA_PWR)           
        if (OUTB_PD.iValue==1) :
            FoutB_PD=True
        if (OUTB_MUX.iValue==0) and (CHDIV_DISTB_EN.iValue==0):
            FoutB_PD=True
        if (OUTB_MUX.iValue==1) and (VCO_DISTB_PD.iValue==1):
            FoutB_PD=True
        if (FoutB_PD==True):
            Dim(FoutB_FREQ)
            Dim(OUTB_MUX)
            Dim(OUTB_PWR)
        else:
            UnDim(FoutB_FREQ)
            UIC_OUTB_MUX.Background = brush_white
            UnDim(OUTB_PWR)
     
        #   Channel Divider & Channel Mux
        if (CHDIV_EN.iValue==0) or (CHDIV_DIST_PD.iValue==1):
            Dim(CHDIV_SEG_SEL)
            if (OUTA_MUX.iValue==0) or (OUTB_MUX.iValue==0):
                UIC_CHDIV_SEG_SEL.Background=brush_violation
                UIC_CHDIV_SEG1.ToolTip="channel divider is used"           
        else:
            UIC_CHDIV_SEG_SEL.Background = brush_white
    
        if (CHDIV_SEG1_EN.iValue==0):
            Dim(CHDIV_SEG1)
            if (CHDIV_SEG_SEL.iValue==1) or (CHDIV_SEG_SEL.iValue==2) or (CHDIV_SEG_SEL.iValue==4):
                UIC_CHDIV_SEG1.Background=brush_violation
                UIC_CHDIV_SEG1.ToolTip="channel divider segment 1 is used"
        else:
            UIC_CHDIV_SEG1.Background = brush_white
     
        if (CHDIV_SEG2_EN.iValue==0):
            Dim(CHDIV_SEG2)
            if (CHDIV_SEG_SEL.iValue==2) or (CHDIV_SEG_SEL.iValue==4):
                UIC_CHDIV_SEG2.Background=brush_violation
                UIC_CHDIV_SEG2.ToolTip="channel divider segment 2 is used"
        else:
            UIC_CHDIV_SEG2.Background = brush_white                
    
        if (CHDIV_SEG3_EN.iValue==0):
            Dim(CHDIV_SEG3)
            if (CHDIV_SEG_SEL.iValue==4):
                UIC_CHDIV_SEG3.Background=brush_violation
                UIC_CHDIV_SEG3.ToolTip="channel divider segment 3 is used"
        else:
            UIC_CHDIV_SEG3.Background = brush_white  
        pass    
    
     
     
    def ValidateFrequencies():
        Fosc=Fosc_FREQ.dValue
    
        #   Check OSCin
        if (Fosc<5):
            UIC_Fosc_FREQ.Background = brush_violation
            UIC_Fosc_FREQ.ToolTip="Minimum Fosc is 5 MHz"
        elif (Fosc>1400):
            UIC_Fosc_FREQ.Background = brush_violation
            UIC_Fosc_FREQ.ToolTip="Maximum Fosc is 1400 MHz"
        else:
            UIC_Fosc_FREQ.Background = brush_white
            UIC_Fosc_FREQ.ToolTip=None
            
        Fosc=Fosc_FREQ.dValue
       
        NewIndex = Fosc/10.0/pow(2,CAL_CLK_DIV.iValue)
        if (ACAL_CMP_DLY.iValue<NewIndex):
            UIC_CAL_CLK_DIV.Background = brush_alert
            UIC_CAL_CLK_DIV.ToolTip = "CAL_CLK_DIV or ACAL_CMP_DLY should be adjusted such that ACAL_CMP_DLY >= (Fosc/10MHz)/2^CAL_CLK_DIV" 
            UIC_ACAL_CMP_DLY.GetTextBox().Background = brush_violation
            UIC_ACAL_CMP_DLY.ToolTip = "CAL_CLK_DIV or ACAL_CMP_DLY should be adjusted such that ACAL_CMP_DLY >= (Fosc/10MHz)/2^CAL_CLK_DIV.  To satisfy this, you could change ACAL_CMP_DLY to "+str(int(NewIndex)) 
        else:
            UIC_CAL_CLK_DIV.Background = brush_white
            UIC_CAL_CLK_DIV.ToolTip = None
            UIC_ACAL_CMP_DLY.GetTextBox().Background = brush_white
            UIC_ACAL_CMP_DLY.ToolTip = None        
    
        #   Check OSCin Doubler
        if  (OSC_2X.iValue+1)*Fosc>1400:
            UIC_OSC_2X.Background = brush_violation
            UIC_OSC_2X.ToolTip = "Maximum Input Frequency for the OSCin doubler is 700 MHz."
        else:
            UIC_OSC_2X.Background = brush_white
            
        #   Check Multiplier  
        PreR=PLL_R_PRE.iValue
        if (0==PreR):
            PreR=1
        MultIn = (OSC_2X.iValue+1)*Fosc/PreR
        MultOut = MultIn*MULT.iValue  
             
        if  (MULT.iValue==1):
            UIC_MULT.Background = brush_white
            UIC_MULT.ToolTip=None
        elif (MULT.iValue==2):
            UIC_MULT.Background = brush_violation
            UIC_MULT.ToolTip="A Multiply value of 2 is not supported.  However this can be done with the OSCin doubler."
        elif (MULT.iValue>6):
            UIC_MULT.Background = brush_violation
            UIC_MULT.ToolTip="Multiply Values of greater than 6 are not supported." 
        elif (MultIn<40):
            UIC_MULT.Background = brush_violation
            UIC_MULT.ToolTip="Minimum input frequency to the Multiplier is 40 MHz"
        elif (MultIn>70):
            UIC_MULT.Background = brush_violation
            UIC_MULT.ToolTip="Maximum input frequency to the Multiplier is 70 MHz"
        elif (MultOut<180):
            UIC_MULT.Background = brush_violation
            UIC_MULT.ToolTip="When the multiplier is engaged, the output frequency has to be at least 180 MHz."
        elif (MultOut>240):
            UIC_MULT.Background = brush_violation
            UIC_MULT.ToolTip="When the multiplier is engaged, the output frequency can not be greater than 240 MHz."  
        else:
            UIC_MULT.Background = brush_white
            UIC_MULT.ToolTip=None
        
        #   Check Phase Detector Frequency 
        if (Fpd_FREQ.dValue<0.25):
            UIC_Fpd_FREQ.Background = brush_violation
            UIC_Fpd_FREQ.ToolTip="Minimum Phase Detector Frequency is 250 kHz."
        elif (Fpd_FREQ.dValue>400):
            UIC_Fpd_FREQ.Background = brush_violation
            UIC_Fpd_FREQ.ToolTip="Maximum Phase Detector Frequency is 400 MHz."
        else:
            UIC_Fpd_FREQ.Background = brush_white
            UIC_Fpd_FREQ.ToolTip=None
            
        #   Set FCAL_LPFD_ADJ and FCAL_LPFD_ADJ
        Fpd=Fpd_FREQ.dValue
    
        if (Fpd<2.5):
            NewIndex=3
            NewIndex2=0
        elif (Fpd<5):
            NewIndex=2
            NewIndex2=0
        elif (Fpd<10):
            NewIndex=1
            NewIndex2=0
        elif (Fpd<100.1):
            NewIndex=0
            NewIndex2=0
        elif (Fpd<150.1):
            NewIndex=0
            NewIndex2=1
        elif (Fpd<200.1):
            NewIndex=0
            NewIndex2=2
        else:
            NewIndex=0
            NewIndex2=3     
     
        if (FCAL_LPFD_ADJ.iValue==NewIndex):
            UIC_FCAL_LPFD_ADJ.Background = brush_white
            UIC_FCAL_LPFD_ADJ.ToolTip=None
        else:
            UIC_FCAL_LPFD_ADJ.Background = brush_alert
            UIC_FCAL_LPFD_ADJ.ToolTip="FCAL_LPFD_ADJ should be adjusted from state " +str(FCAL_LPFD_ADJ.iValue)+ " to state "+str(NewIndex) 
            
        if (FCAL_HPFD_ADJ.iValue==NewIndex2):
            UIC_FCAL_HPFD_ADJ.Background = brush_white
            UIC_FCAL_HPFD_ADJ.ToolTip=None
        else:
            UIC_FCAL_HPFD_ADJ.Background = brush_alert
            UIC_FCAL_HPFD_ADJ.ToolTip="FCAL_LPFD_ADJ should be adjusted from state " +str(FCAL_HPFD_ADJ.iValue)+ " to state "+str(NewIndex2)   
    
          
        #   Validate PRE_N
        if (PLL_N_PRE.iValue==0):
            if (1==VCO_2X.iValue):
                UIC_PLL_N_PRE.ToolTip="The Pre-N divider needs to be 4 whenver the VCO doubler is used."
                UIC_PLL_N_PRE.Background=brush_violation 
            elif (Fpd_FREQ.dValue<5.0001):
                UIC_PLL_N_PRE.ToolTip="The Pre-N divider needs to be 4 whenever the phase detector frequency is <=5 MHz."
                UIC_PLL_N_PRE.Background=brush_violation
            else:
                UIC_PLL_N_PRE.ToolTip=None
                UIC_PLL_N_PRE.Background=brush_white
        else:
            UIC_PLL_N_PRE.ToolTip=None
            UIC_PLL_N_PRE.Background=brush_white
    
        #   Check N Divider, Order, and PFD_DLY
        N=PLL_N.iValue
        Order = MASH_ORDER.iValue
        Nmin=1
        PFD_DLYnew=0
        
        if (Order==0):
            Nmin=9
            PFD_DLYnew=1
        elif (Order==1):
            Nmin=11
            PFD_DLYnew=1
        elif (Order==2):
            Nmin=16
            PFD_DLYnew=2
        elif (Order==3):
            Nmin=18
            PFD_DLYnew=2
        elif (Order==4):
            Nmin=30
            PFD_DLYnew=8
         
        if (N<9):
            UIC_PLL_N.ToolTip="PLL_N values below 9 are not supported"
            UIC_PLL_N.GetTextBox().Background = brush_violation
            UIC_MASH_ORDER.ToolTip=None
            UIC_MASH_ORDER.Background=brush_white
        elif (N<Nmin):
            UIC_PLL_N.ToolTip="This PLL_N value is too low for this MASH_ORDER, but could be supported if the MASH_ORDER is reduced."
            UIC_PLL_N.GetTextBox().Background = brush_alert
            UIC_MASH_ORDER.Background=brush_alert   
            if (N<16):
                UIC_MASH_ORDER.ToolTip="Try using the 1st Order Modulator."
            elif (N<18):
                UIC_MASH_ORDER.ToolTip="Try using the 2nd Order Modulator."
            elif (N<30):
                UIC_MASH_ORDER.ToolTip="Try using the 3rd Order Modulator."
        else:
            UIC_PLL_N.ToolTip= None
            UIC_PLL_N.GetTextBox().Background = brush_white      
            UIC_MASH_ORDER.ToolTip=None
            UIC_MASH_ORDER.Background=brush_white
            
        if (PFD_DLY.iValue==PFD_DLYnew):
            UIC_PFD_DLY.ToolTip= None
            UIC_PFD_DLY.Background=brush_white
        else:
            UIC_PFD_DLY.ToolTip="State "+str(PFD_DLY.iValue)+" should be changed to state " + str(PFD_DLYnew) + ".  If already at this state, toggle this to another state and back to clear this warning."
            UIC_PFD_DLY.Background = brush_alert
            
        #   Validate Fnum   
        if (PLL_NUM.iValue>0) and (MASH_ORDER.iValue==0):
            UIC_PLL_NUM.GetTextBox().Background=brush_violation
            UIC_PLL_NUM.ToolTip="This fractional numerator will be ignored unless MASH_ORDER>0"
        else:
            UIC_PLL_NUM.GetTextBox().Background=brush_white
            UIC_PLL_NUM.ToolTip=None      
            
    
        #   Check MASH_DITHER
        UIC_MASH_DITHER.Background=brush_white
        UIC_MASH_DITHER.ToolTip=None
        
        if (MASH_DITHER.iValue==1):
            Fnum=PLL_NUM.iValue
            Fden=PLL_DEN.iValue
            if (Fnum==0):
                Fden=1
            while ( (0 == (Fnum%2)) and (0==(Fden%2))):
                Fnum=Fnum/2
                Fden=Fden/2
            while ( (0 == (Fnum%3)) and (0==(Fden%3))):
                Fnum=Fnum/3
                Fden=Fden/3
            while ( (0 == (Fnum%3)) and (0==(Fden%3))):
                Fnum=Fnum/3
                Fden=Fden/3
                
            NoDither=0
            if (Fnum==0):
                NoDither=1
            if (MASH_ORDER.iValue<2):
                NoDither=1
            if (0 < (Fden % 2)) and (MASH_ORDER.iValue==2):
                NoDither=1
            if (0 <(Fden % 2)) and (0 <(Fden % 3)) and(MASH_ORDER.iValue>2):
                NoDither=1
    
            if (NoDither==1):
                UIC_MASH_DITHER.Background=brush_alert
                UIC_MASH_DITHER.ToolTip="Dithering will likely not improve performance in this situation as there should be no sub-fractional spurs."
                
        #   Check Charge Pump Gain Multiplier
        if (MUXOUT_SEL.iValue==0) or (LD_TYPE==0) or (CP_ICOARSE.iValue==0):
            UIC_CP_ICOARSE.Background=brush_white
            UIC_CP_ICOARSE.ToolTip=None
        else:
            if (CP_ICOARSE.iValue==3):
                UIC_CP_ICOARSE.Background=brush_violation
            else:
                UIC_CP_ICOARSE.Background=brush_alert
                
            UIC_CP_ICOARSE.ToolTip="The analog lock detect is not reliable when the charge pump gain multiplier is used.  Consider using digital lock detect or not using this gain multiplier."
            if (CalculatedCPG.dValue<9.7):
                UIC_CP_ICOARSE.ToolTip=UIC_CP_ICOARSE.ToolTip+"  In this case, you can get a simlar gain by setting the gain multiplier to one and increasing the charge pump gain."
               
    
        #   Check VCO Frequency
        if (Fvco_FREQ.dValue<3550):
            UIC_Fvco_FREQ.ToolTip="Minimum VCO Frequency is 3550 MHz."
            UIC_Fvco_FREQ.Background = brush_violation
        elif (Fvco_FREQ.dValue>7100):
            UIC_Fvco_FREQ.Background = brush_violation
            UIC_Fvco_FREQ.ToolTip="Maximum VCO Frequency is 7100 MHz."
        else:
            UIC_Fvco_FREQ.Background = brush_white
            UIC_Fvco_FREQ.ToolTip=None
    
          
        #   Check VCO Doubler
        UIC_VCO_2X.Background = brush_white
        UIC_VCO_2X.ToolTip = None
        UIC_OUTA_MUX.Background = brush_white
        UIC_OUTA_MUX.ToolTip = None
        UIC_OUTB_MUX.Background = brush_white
        UIC_OUTB_MUX.ToolTip = None
        
        if (1==VCO_2X.iValue):
            if (Fvco_FREQ.dValue>4900):
                UIC_VCO_2X.Background = brush_violation
                UIC_VCO_2X.ToolTip="The VCO doubler can not be used if the VCO frequency is greater than 4900 MHz."
      
        #   Validate Output Frequencies
        if (FoutA_FREQ.dValue<18.5):
            UIC_FoutA_FREQ.ToolTip="Minimum output frequency is 18.5 MHz."
            UIC_FoutA_FREQ.Background = brush_violation
        elif (FoutA_FREQ.dValue>9800):
            UIC_FoutA_FREQ.Background = brush_violation
            UIC_FoutA_FREQ.ToolTip="Maximum output frequency is 5500 MHz."
        elif (OUTA_MUX.iValue==0) and (VCO_MULTIPLIED_FREQ.dValue>7100):
            UIC_FoutA_FREQ.Background = brush_violation
            UIC_FoutA_FREQ.ToolTip="The Output Divider can not be used above VCO frequencies above 7100MHz."
        else:
            UIC_FoutA_FREQ.Background = brush_white
            UIC_FoutA_FREQ.ToolTip=None
            
        if (FoutB_FREQ.dValue<18.5):
            UIC_FoutB_FREQ.ToolTip="Minimum output frequency is 18.5 MHz."
            UIC_FoutB_FREQ.Background = brush_violation
        elif (FoutB_FREQ.dValue>9800):
            UIC_FoutB_FREQ.Background = brush_violation
            UIC_FoutB_FREQ.ToolTip="Maximum output frequency is 5500 MHz."
        elif (OUTB_MUX.iValue==0) and (VCO_MULTIPLIED_FREQ.dValue>7100):
            UIC_FoutB_FREQ.Background = brush_violation
            UIC_FoutB_FREQ.ToolTip="The Output Divider can not be used above VCO frequencies above 7100MHz."
        else:
            UIC_FoutB_FREQ.Background = brush_white
            UIC_FoutB_FREQ.ToolTip=None   
    
        UpdatePowerSettings()     
    
        #   Validate Output Powerdown
        if (OUTA_PWR.iValue>31) and (OUTA_PWR.iValue<48):
            UIC_OUTA_PWR.GetTextBox().Background = brush_alert
            UIC_OUTA_PWR.ToolTip="Settings 32 to 47 are redundant and act as 16 counts lower.  In other words, setting 32 is the same as 16 and setting 47 is the same as setting 31."
        else:
            UIC_OUTA_PWR.GetTextBox().Background=brush_white
            UIC_OUTA_PWR.ToolTip=None  
    
        #   Validate Output Powerdown
        if (OUTB_PWR.iValue>31) and (OUTB_PWR.iValue<48):
            UIC_OUTB_PWR.GetTextBox().Background = brush_alert
            UIC_OUTB_PWR.ToolTip="Settings 32 to 47 are redundant and act as 16 counts lower.  In other words, setting 32 is the same as 16 and setting 47 is the same as setting 31."
        else:
            UIC_OUTB_PWR.GetTextBox().Background=brush_white
            UIC_OUTB_PWR.ToolTip=None  
            
    
    def btn_LoadRegisters_Update():
        btn_LoadRegisters.Background=brush_white
        btn_LoadRegisters.ToolTip=None
        UIC_FCAL_EN.Background=brush_white
        UIC_FCAL_EN.ToolTip=None
        WriteAllRegisters()
        
    def FCAL_EN_Update():
        btn_LoadRegisters.Background=brush_white
        btn_LoadRegisters.ToolTip=None
        UIC_FCAL_EN.Background=brush_white
        UIC_FCAL_EN.ToolTip=None
        
    def btn_SimplifyFraction_Update():
        Fnum=PLL_NUM.iValue
        Fden=PLL_DEN.iValue
    
    
        if  ((Fnum==0) or (Fden==0)):
            Fden=1
            Fnum=0
        else:
            Divisor = 2      
            while ( Divisor<Fnum+1):
                if (0 == (Fnum % Divisor)) and (0 == (Fden % Divisor)):
                    Fnum=Fnum/Divisor
                    Fden=Fden/Divisor
                else:
                    Divisor=Divisor+1
                    
            if (Fden%Fnum==0):
                Fden=Fden/Fnum
                Fnum=1
        
        UpdateStatusBar("Fraction Simplified to "+str(Fnum)+"/"+str(Fden))     
        PLL_DEN.iValue=Fden
        PLL_NUM.iValue=Fnum
        
    def CAL_CLK_DIV_Update_UI():
        ValidateFrequencies()
    
    def FCAL_HPFD_ADJ_Update_UI():
        ValidateFrequencies()
        
    def FCAL_LPFD_ADJ_Update_UI():
        ValidateFrequencies()
        
    def MASH_ORDER_Update_UI():
        ValidateFrequencies()
        
    def PFD_DLY_Update_UI():
        ValidateFrequencies()
    

    Regards,