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.

AFE7900: RF & microwave forum

Part Number: AFE7900

I am trying to send a ramp test pattern on ADC. In order to do this, I have written a small piece of code in the Latte software.

AFE.JESD.ADCJESD[0].adcRampTestPattern(0,1,1)

When this function is called, I get the following prints in the Latte log.

Entered: adcRampTestPattern of class ADCJesdLib
Writing into  0x0015 value  0x00
Writing into  0x0016 value  0x01
Writing into  0x0109 value  0x02
Writing into  0x0109 value  0x0a

When I go to the tiAfe79_jesd.c file that contains the adcRampTestPattern function, it is as follows:

TI_AFE_API_COMP uint8_t AFE79FNP(adcRampTestPattern)(AFE79_INST_TYPE afeInst, uint8_t topno, uint8_t chNo, uint8_t enable, uint8_t rampIncr)
{
    uint8_t errorStatus = 0;
    AFE79_ID_VALIDITY();
    AFE79_PARAMS_VALID(topno < AFE79_NUM_JESD_INSTANCES);
    AFE79_PARAMS_VALID(chNo < 3);
    AFE79_SPI_EXEC(AFE79FNP(afeSpiWriteWrapper)(afeInst, 0x16, ((1 << (topno))) & 0xff, 0x0, 0x7)); /*adc_jesd*/
    if (chNo == 0)
    {
        if (enable == 1)
        {
            AFE79_SPI_EXEC(AFE79FNP(afeSpiWriteWrapper)(afeInst, 0x109, (((rampIncr) << 3) + 0x2) & 0xff, 0x0, 0x7)); /*rx1_jesd_test_sig_gen_mode, rx1_jesd_ramptest_incr*/
        }
        else
        {
            AFE79_SPI_EXEC(AFE79FNP(afeSpiWriteWrapper)(afeInst, 0x109, 0x0, 0x0, 0x2)); /*rx1_jesd_test_sig_gen_mode*/
        }
    }
    else if (chNo == 1)
    {
        if (enable == 1)
        {
            AFE79_SPI_EXEC(AFE79FNP(afeSpiWriteWrapper)(afeInst, 0x10a, (((rampIncr) << 3) + 0x2) & 0xff, 0x0, 0x7)); /*rx2_jesd_test_sig_gen_mode, rx2_jesd_ramptest_incr*/
        }
        else
        {
            AFE79_SPI_EXEC(AFE79FNP(afeSpiWriteWrapper)(afeInst, 0x10a, 0x0, 0x0, 0x2)); /*rx2_jesd_test_sig_gen_mode*/
        }
    }
    else if (chNo == 2)
    {
        if (enable == 1)
        {
            AFE79_SPI_EXEC(AFE79FNP(afeSpiWriteWrapper)(afeInst, 0x10b, (((rampIncr) << 3) + 0x2) & 0xff, 0x0, 0x7)); /*fb_jesd_test_sig_gen_mode, fb_jesd_ramptest_incr*/
        }
        else
        {
            AFE79_SPI_EXEC(AFE79FNP(afeSpiWriteWrapper)(afeInst, 0x10b, 0x0, 0x0, 0x2)); /*fb_jesd_test_sig_gen_mode*/
        }
    }
    AFE79_SPI_EXEC(AFE79FNP(afeSpiWriteWrapper)(afeInst, 0x16, 0x0, 0x0, 0x7));

    if (errorStatus)
        return TI_AFE_RET_EXEC_FAIL;
    else
        return TI_AFE_RET_EXEC_PASS;
}

Can anyone please explain to me which function is writing into the 0x0015 register and why the 0x109 register is being written into twice?

  • Hi Mubashira,

    The write to register 0x15 is simply closing the previously open page, so that we can open the ADC_JESD page. This is not shown in the C function as it assumes the previous page has already been closed. 

    In the Latte software there are two writes to register 0x109 because enabling the test pattern and setting the ramp step size are done in two steps. The first write, 0x2, enables the ramp test pattern mode and the second write, 0xa, changes the ramp step size to '2'. The C function sets both the enable and ramp step size in a single step. 

    Regards,

    David Chaparro

  • Hi David,

    Thank you for your reply. Thank you for your explanation.

    I had the understanding that the Latte software called the C API's in the backend. Does this mean that Latte is called some other functions in the background? If yes, where can I locate those functions?

  • Hi Mubashira,

    The Latte software has python libraries that are used in the background, but the C functions can also be used in the Latte software by use CAFE.FunctionName(). These can be found in the following folder: C:\Users\<UserName>\Documents\Texas Instruments\Afe79xxLatte\lib\Afe79xxLibraries\AFE79xxLibraryPG1p0 

    Regards,

    David Chaparro