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?