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.

LMX2581EVM: Generating a frequency sweep using flex script

Part Number: LMX2581EVM
Other Parts Discussed in Thread: LMX2581, CODELOADER

I need to generate a frequency sweep using the LMX2581EVM to evaluate it's performance. This will be how it's used in our application, but we need to evaluate the chip before designing our own board.

It appears that the Flex script capability of Codeloader should be able to do this. I can't find any examples or coding guideline for creating Flex scripts for the LMX2581.

I have the registers set for manually tuning and the EVM seems to work fine.  But, I need to do a repetitive sweep over the 2.4->2.5GHz ISM band with 100KHz steps (or better). Sweep rate is not important.

Can anyone point me in the right direction?

Thank you,

 -John DeMar,

  • John,

    CodeLoader and TICSPro both support automation.

    COdeLoader automation is described in this document

    TICSPro can be done as well.  I attached a document for this.


    Dean Banerjee

    TicsPro Automation with Labview.pdf

  • I was able to get a VB script working in Excel to control the board. The examples are somewhat out-dated and needed modification to work with. The registered object is "CodeLoader4x.Application" and not "CodeLoader2x.Application". And the PLL name is "PLL" and not "RF PLL".

    I have to set up the EVM in CodeLoader4 before running the script because I could not figure out how to access all of the control names and bit fields. There doesn't seem to be a reference for this for the LMX2581.

    It is quite slow... maybe 40 frequencies steps per second. 

    Here's the code:

    Sub main()
    'Frequency sweep for LMX2581,, May 22, 2017
    F_start = 2400
    F_end = 2500
    F_step = 1
    Dim PLLobject As Object
    Set PLLobject = CreateObject("CodeLoader4x.Application")
    PLLobject.SelectPart "LMX2581"
    PLLobject.SetVCOFrequency "PLL", F_start * 1
    Range("A2").Value = PLLobject.GetOSCinFrequency("PLL")
    Range("A3").Value = PLLobject.GetVCOFrequency("PLL")
    For j = 1 To 10
    steps = (F_end - F_start) / F_step
    f = F_start
    For i = 0 To steps
    PLLobject.SetVCOFrequency "PLL", f * 1
    f = f + F_step
    Next i
    Next j Range("B3").Value = PLLobject.GetVCOFrequency("PLL") End Sub

    The sweep works well, replacing the analog VCO in my test system. But it is VERY noisy! There are large random spikes at many of the frequency changes.

    Any suggestions on how to command smooth transitions as an alternative to SetVCOFrequency ?  Without a solution to this, it will be impossible to design our system with this part.

    Thanks for the help,


  • John,

    I'm glad to see your automation is working.

    For your rough at frequency changes, I think you are seeing the VCO Calibrate, which is a reality for just about all VCOs on silicon.

    The VCO typically starts at a frequency band specified by the VCO_SEL and VCO_CAPCODE words.  However, in this case, it sounds like you want to tell the VCO to start at the same settings as for the last frequency.

    If this is the case consider setting the VCO_SEL_MODE (R5[16:15])  bit to "use last VCO selected" to get a smaller glitch.  If you program in a value in the VCO_CAPCODE that is close to the final value, you can get something even closer.



  • Dean,

      What is the VB script syntax and names for the fields and methods required to set the LMX2581 registers you are referring to?

    Is there a definitive list somewhere?



  • John,

    That other document was all we had for this on CodeLoader;  there is no other CodeLoader document.   

    There is no special LMX2581 commands.

    Here are some commands from our code

    PLLLoader is the object created for CodeLoader

    SetPLL is the  returned value

    "FirstLine" is a variable which describes the bit name, or the name on the PLL tab.  With these commands, you can change any programmable field on the CodeLoader via automation.

    Hope this helps.




                SetPLL = CStr(PLLLoader.GetOSCinFrequency(Firstline))
                SetPLL = CStr(PLLLoader.GetPDFrequency(Firstline))
                SetPLL = CStr(PLLLoader.GetPrgmBits(Firstline))
                SetPLL = CStr(PLLLoader.GetPrgmBitsText(Firstline))
                SetPLL = CStr(PLLLoader.GetPrgmBitValue(Firstline))
                SetPLL = CStr(PLLLoader.GetPrgmPins(Firstline))
                SetPLL = CStr(PLLLoader.GetVCOFrequency(Firstline))
                PLLLoader.SetPDFrequency Firstline, CDbl(Parameter)
                PLLLoader.SetPrgmBits Firstline, CDbl(Parameter)
                PLLLoader.SetPrgmBitValue Firstline, CDbl(Parameter)
                PLLLoader.SetPrgmBitsText Firstline, Parameter
                PLLLoader.SetPrgmPins Firstline, CBool(Parameter)
                PLLLoader.SetVCOFrequency Firstline, CDbl(Parameter)
                PLLLoader.SetNValue Firstline, CDbl(Parameter)

  • Thank you for the reply. It is unfortunate that TI offers a tool with little or no documentation or examples.

    Your list of object methods is very helpful.

    You said:   "FirstLine" is a variable which describes the bit name, or the name on the PLL tab.

    How do I determine the valid bit names?  Are they the names of the fields in the dialogs in Codeloader?

    Likewise, in your examples, is "Firstline" the name on tab when selecting the dialog?

    This may be obvious, but I just want to make sure.



  • John,

    This was copied from an excel sheet that is flexible and can run all CodeLoader commands. "FirstLine" is the first line in the excel and "Parameter" is the value to change it to. "FirstLine" can be the programmable name for some commands, or the PLL for others.

    Here are some examples:

    PLLLoader.SetPrgmBitValue "PLL_N", 25
    PLLLoader.SetPrgmBitsText "FRAC_ORDER","2nd Order Modulator"
    PLLLoader.SetVCOFrequency "PLL",3000