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.

AFE7900EVM: AFE7900EVM configuration from external Python script (outside the Latte)

Part Number: AFE7900EVM
Other Parts Discussed in Thread: AFE7900, LMK04828, AFE7950

Hi TI Team,

Setup description:

I have AFE7900EVM with ZCU102 board. For AFE7900 initical setup I use the Latte GUI with marked scripts. Everything works fine as I expected.

But my question is - is possible to run my custom script (outside the Latte GUI) where I will be able to execute the same steps? If yes, how I can do it (where libraries are located, which python version I will need, etc.) 

Thanks in advance!

  • Hi Tomas,

    There are a couple methods that you can use to program the AFE outside of Latte. 

    The first method is to run your script in Latte and have it produce a configuration file, which contains all register writes/reads/polls required to bringup the AFE. With this configuration file you can then program the AFE using your own SPI module. To enable the generation of the configuration file you can set the 'logDumpInst.logFormat' parameter to '0x1'. 

    Another method is to control the Latte GUI through Python, as outlined in the following App Note: https://www.ti.com/lit/an/sbaa397/sbaa397.pdf. The bsocket document that is mentioned is available in the AFE79xx secure folder.

    Regards,

    David Chaparro

  • Hi

    Thanks, I will triy it in a few days.

  • Hi David,
    is possible to get DLL library instead of exe?
    I would like to run one python script with no exe 3rd party SW. Now I have to run Latte and in the Latte I need run 4 scrhipts in correct order. What I want is  replace all of these precedures with my own python script to deliver easier setup during the evaluation process. 

  • Hi Tomas,

    We do not have a dll for the Latte software. One thing to note is that the first method that I mention above will have to be used at least one time with your configuration in order to generate the configuration file, which contains all reads/writes/polls in the correct order required to bringup the AFE. Using this configuration file you can program the AFE without the Latte software, using your own python script. 

    To configure the AFE on the EVM using the configuration file generated by Latte you can use the TI FTDI dll to execute the SPI reads/writes. The files and instructions for this can be downloaded with the link below. 

    Link: https://tidrive.ext.ti.com/u/sfWwvyJ1sMCj9bC4/8830537e-93cb-4d0c-8084-8a93fb6683d9?l 

    Access Code: m5iVB9g=

    Regards,

    David Chaparro

  • Hi David,

    Thank you for your response and the link. On the AFE7900EVM board, there is also an LMK circuit for clock generation. This circuit will need to be configured separately, am I correct? Thank you very much.

  • Hello again

    Maybe I wasn't completely accurate in what I need. I have an AFE7900EVM board and I need to configure it entirely by running a single command in the command line, without anyone having to run Latte and execute a sequence of several scripts there.

    It probably involves configuring the AFE7900 and LMK04828. I understand that the Intel CPLD is not used here and there is no need to work with it (is is true?)

    Thank you.

  • Hi Tomas,

    The CPLD is not used so there is no need to interface with it. 

    To log the LMK writes in the configuration file you can follow the steps mentioned below:

    1. Add ‘lmk.logClassInst=logDumpInst’ to the devInit script.

            2. Add ‘lmk.rawWriteLogEn = 1’ to the AFE79xx script.

    Once you have these writes you can also program the the LMK using the FTDI dll previously provided. To instantiate the LMK you can use the below code as reference. Using the previously provided code example you can use this to program the LMK and AFE without using the AFE79xx GUI and running multiple scripts. 

    AFEserial = "FT8A8V8P"
        AFEAserial = AFEserial + 'A'
        AFENUM = 0
        FTDI_A = ctypes.c_void_p()
        AFE_PROT = ctypes.c_void_p()
        TI_FTDI.setupFTDIdev(ctypes.byref(FTDI_A), AFEAserial.encode(), 12000000) #maximum baud rate. 
        TI_FTDI.initSPIDev(ctypes.byref(AFE_PROT), 0, 3, 1, 2, 15, 8, True, True)
        TI_FTDI.mapHandles(FTDI_A, AFE_PROT, AFENUM)
     
        LMK1serial = "FT8A8V8P"
        LMK1Bserial = LMK1serial + 'B'
        LMKNUM = 0
        FTDI_1 = ctypes.c_void_p()
        LMK_PROT = ctypes.c_void_p()
        TI_FTDI.setupFTDIdev(ctypes.byref(FTDI_1), LMK1Bserial.encode(), 12000000) #maximum baud rate. 
        TI_FTDI.initSPIDev(ctypes.byref(LMK_PROT), 6, 5, 7, 4, 15, 8, True, True)
        TI_FTDI.mapHandles(FTDI_1, LMK_PROT, LMKNUM)
        spiwrites.LMKprog(TI_FTDI, LMKNUM)
        spiwrites.AFEprog(TI_FTDI, AFENUM)
    

     

    Regards,

    David Chaparro

  • Hi David,

    thanks a lotw, I will try it.

    Secondly, can I ask you for a link to the latest version of Latte? It probably doesn't matter, but I'm not completely satisfied with the line numbers and I would like to have the same starting point as you.

    Thanks

    Tomas

  • Hi Tomas,

    The latest version of the GUI, now called 'AFE79xx' and not 'Latte', is available in the AFE79xx secure folder.

    Regards,

    David Chaparro

  • Hi David,

    I'm currently trying to generate dump files. Am I understanding correctly (if this is the correct behavior) that in the first step I generate a dump for AFE, and in the next step for LMK? And using SPI_Convert.py (which I always modify), I generate two different spiwrite files? Thank you very much for the clarification.

  • Hello David,

    I tried to reproduce your recommendations with the following result:

    1. ZCU102 connected to AFE7900 (ZCU102 is not powered on)
    2. After powering on the AFE7900EVM, the current consumption is approximately 0.67 A (at Ucc = 5.3 V).
    3. I run the AFE7950_SPI.py script with the attached result.
    4. The current consumption decreases to approximately 0.36 A


    Do you have any advice on what might be wrong or what I am doing wrong?

    Console output: output.txt
    Python script: AFE7950_SPI.py

  • Hi Tomas,

    Yes, you will need to create to configuration files, one for the AFE and one for the LMK. 

    One thing to check is that when you program the LMK do you see the 'LMK LOCKED' LED, D4, turn on? If not then the issue may be with the clock to the AFE. If you can also share the SPI writes that you are using I can test this on my side. Are you using the Latte script from the AFE79xx_ZCU102 8b10b reference design?

    Regards,

    David Chaparro

  • Hi David,
    I am using the ZCU102_AFE79xx_64b66b_12Gbps.zip design (FPGA reference designs as well as Latte scripts). I known, in the second one thread we also discuss 8b10b design but it is a parallel task. 

    What is tested and works well: 
    setup.py -> devinit.py -> TI_IP_12Gbps_8Lane_ConfigLmk.py in this order. Everything works well (but D4 is not turn in in this state, but D3 yes) 

    Then I tried to generate SPI writes:

    1) I set the logDumpInst.logFormat=0x21 and I got Afe79xxPg1Format5.txt

    2) I ran the SPI_convert.py and I got the spiwrites_step2.py
    3)  I added the  ‘lmk.logClassInst=logDumpInst’ to the devInit script and  ‘lmk.rawWriteLogEn = 1’ to the AFE79xx script
    4) I got the a new one Afe79xxPg1Format5.txt 

    5) I applied the modified SPI_Convert_LMK.py (AFENUm was replaced with LMKNUM and AFEprog was replaced with LMKprog) and I got spiwrites.py

    6) Finally, after device restart (power cycle) I tried run AFE7950_SPI.py - but without success, D3 and D4 LEDs not turned on.

     The scripts discussed above are attached here: LatteConfig

  • Hi Tomas,

    It looks like the LMK is not being programmed correctly. After looking at the spiwrites file it looks like this file contains writes for both the LMK and AFE. This means that you are programming the LMK with the AFE register writes. 

    To capture only the LMK writes you should follow your step 3 and then only run the TI_IP_12Gbps_8Lane_ConfigLmk script. This should only have writes for the LMK and the number of writes should be a couple hundred.

    Regards,

    David Chaparro

  • Hi David,

    Thank you for the heads up - I have fixed it. However, I am still unable to achieve success. 

    Scripts are located here: LatteConfig  and they shoud be correct (hopoefully). It seems that there is some error during the readback? 

    Maybe, the console output could be important: output.txt 

  • Hi David,

    is there any udpate on this issue? 

    Regards,

    Tomas 

  • Hi Tomas,

    After looking at your scripts the issue is that the LMKNUM parameter should be set to '1'. When both the AFENUM and LMKNUM are set to the same value the first one is being overwritten.

    Please update this in your script and you should be able to program the EVM now.

    Regards,

    David Chaparro 

  • Hi David,

    Thank you very much for your help! The configuration according to your instructions works. In fact, I will have different setting parameters (different LMFSH, DDC, etc.), but I don't see any problem with that using this guide.

    Just to mention, if someone else is trying to solve this, I had some trouble with AFE (wrong readings) in the last step, which was caused by forgetting to close Latte GUI.