ADRV9002 Code Review

DEARS.

The code below is the init file (C++) and log (txt) running on our board.
Error executing "adi_adrv9001_cals_ExternalPathDelay_Calibrate()"

Please check if the DPD code processing order for ADRV9002 is correct.


Please give me a code guide for the DPD part of ADRV9002.

---- init file (C++) ----

int adrv9002::init(void)
{
    int32_t error_code = 0;

    unsigned char cal_error = 0;
    unsigned long path_delay_ps = 0;

    adi_adrv9001_Device_t* adrv9001Device_0 = (adi_adrv9001_Device_t*) calloc(1sizeof(adi_adrv9001_Device_t));
    adi_fpga9001_Device_t* fpga9001Device_0 = (adi_fpga9001_Device_t*) calloc(1sizeof(adi_fpga9001_Device_t));
    error_code = linux_uio_initialize(adrv9001Device_0, fpga9001Device_0, NULL);
    AUTOGENERATOR_ERROR_HANDLER(error_code);

    error_code = initialize(adrv9001Device_0, fpga9001Device_0);
    AUTOGENERATOR_ERROR_HANDLER(error_code);

    error_code = calibrate(adrv9001Device_0);
    AUTOGENERATOR_ERROR_HANDLER(error_code);

    error_code = configure(adrv9001Device_0);
    AUTOGENERATOR_ERROR_HANDLER(error_code);

    error_code = prime(adrv9001Device_0, fpga9001Device_0);
    AUTOGENERATOR_ERROR_HANDLER(error_code);

    error_code = beginReceiving(adrv9001Device_0, fpga9001Device_0);
    AUTOGENERATOR_ERROR_HANDLER(error_code);

    //error_code = stopReceiving(fpga9001Device_0, adrv9001Device_0);
    AUTOGENERATOR_ERROR_HANDLER(error_code);

    error_code = beginTransmitting(adrv9001Device_0, fpga9001Device_0);
    AUTOGENERATOR_ERROR_HANDLER(error_code);

    error_code = stopTransmitting(fpga9001Device_0, adrv9001Device_0);
    AUTOGENERATOR_ERROR_HANDLER(error_code);

    // AUXADC
    //adi_adrv9001_AuxAdc_Configure(adrv9001Device_0, ADI_ADRV9001_AUXADC0, true);
    //adi_adrv9001_AuxAdc_Configure(adrv9001Device_0, ADI_ADRV9001_AUXADC1, true);
    //adi_adrv9001_AuxAdc_Configure(adrv9001Device_0, ADI_ADRV9001_AUXADC2, true);
    //adi_adrv9001_AuxAdc_Configure(adrv9001Device_0, ADI_ADRV9001_AUXADC3, true);

    // AUXDAC
    //adi_adrv9001_AuxDac_Configure(adrv9001Device_0, ADI_ADRV9001_AUXDAC2, true); // HPA_BIAS
    //adi_adrv9001_AuxDac_Code_Set(adrv9001Device_0, ADI_ADRV9001_AUXDAC2, 0x000);
    //adi_adrv9001_AuxDac_Code_Set(adrv9001Device_0, ADI_ADRV9001_AUXDAC2, 0xB88);


    // DPD -- refer UG-1828 (page 188)
    // 1. Select desired profile.
    // 2. Perform board configuration to indicate external loop-back path wit external power amplifier is available.
    // 3. Enter the peak power of the loop-back signal
    fpga_write(0x480x0001); // Peak power wide band signal enable 1
    fpga_write(0x4A0x1525); // Peak power wide band signal enable 2
    fpga_write(0x100x0000); // AMP ON
    HAL_Delay(1000);

    // 4. Measure the external loop-back delay and provide it through TES.
    //    This could be done through API commands which will be discussed at the end of this section
    Uart_Printf("DPD 4-1\r\n");
    adi_adrv9001_cals_ExternalPathDelay_Calibrate(adrv9001Device_0, ADI_CHANNEL_2, 60000, &cal_error, &path_delay_ps);
    Uart_Printf("\r\n\r\n");

    Uart_Printf("DPD 4-2\r\n");
    adi_adrv9001_cals_ExternalPathDelay_Set(adrv9001Device_0, ADI_CHANNEL_2, path_delay_ps);
    Uart_Printf("\r\n\r\n");

    adi_adrv9001_cals_ExternalPathDelay_Get(adrv9001Device_0, ADI_CHANNEL_2, &path_delay_ps);

    //Uart_Printf("path_delay_ps: %d\r\n", path_delay_ps);
    fpga_write(0x100x0001); // AMP OFF

    // 5. Configure other initialization parameters such as RF frequency, LO source, and so on as desired.
    //    Also, enabling DPD for transmitter and configure the model tap polynomial terms.
    //    It is recommended to start with the default model tap.
    adi_adrv9001_DpdInitCfg_t dpdInitConfig =
    {
        .enable = true,
        .amplifierType = ADI_ADRV9001_DPDAMPLIFIER_DEFAULT,
        .lutSize = ADI_ADRV9001_DPDLUTSIZE_512,
        .model = ADI_ADRV9001_DPDMODEL_4,
        .changeModelTapOrders = false,
        .modelOrdersForEachTap = {0x001F0x007F0x001F0x001E},
        .preLutScale = 4, // 2.0 ?
    };
    adi_adrv9001_dpd_Initial_Configure(adrv9001Device_0, ADI_CHANNEL_2, &dpdInitConfig);

    adi_adrv9001_DpdCfg_t dpdConfig =
    {
        .numberOfSamples = 4096,
        .outlierRemovalEnable = false,
        .outlierRemovalThreshold = 0,
        .additionalPowerScale = 4,
        .rxTxNormalizationLowerThreshold = 3395470, // -25 dBFS (default)
        .rxTxNormalizationUpperThreshold = 33954698, // -15 dBFS (default)
        .immediateLutSwitching = true,
        .useSpecialFrame = false,
        .resetLuts = false,
    };
    adi_adrv9001_dpd_Configure        (adrv9001Device_0, ADI_CHANNEL_2, &dpdConfig);

    // 6. Turn on DPD tracking calibration and all the other available tracking calibrations and
    //    start with the default DPD post calibration parameter settings provided in TES.
    adi_adrv9001_TrackingCals_t cals;
    adi_adrv9001_cals_Tracking_Get(adrv9001Device_0, &cals);

    cals.chanTrackingCalMask[1] = (adi_adrv9001_TrackingCalibrations_e)(cals.chanTrackingCalMask[1] | ADI_ADRV9001_TRACKING_CAL_TX_DPD);
    adi_adrv9001_cals_Tracking_Set(adrv9001Device_0, &cals);

    // 7. After programming, load, and play the provided sample transmit input file.
    fpga_write(0x480x0001); // Peak power wide band signal enable 1
    fpga_write(0x4A0x1525); // Peak power wide band signal enable 2
    fpga_write(0x100x0000); // AMP ON

    return error_code;
}
----  log ---
AFE Init...
[ADRV9002] bootState = 0 [0x0B] 56
[ADRV9002] bootState = 0 [0x0B] 56
[ADRV9002] bootState = 1 [0x0B] 56
[ADRV9002] InitDigital - arm check - check arm boot ready
DPD 4-1
[ERR CODE:3, ACTION:-101] ArmCmdStatusWait() failed due to thrown ARM error. Is device in correct state for calling command?
[ERR CODE:3, ACTION:-101] ArmCmdStatusWait() failed due to thrown ARM error. Is device in correct state for calling command?
[ERR CODE:65303, ACTION:-2] Error occurred in Firmware System code


DPD 4-2


Done
Thank you.

Top Replies

Parents
  • 0
    •  Analog Employees 
    on Jul 6, 2021 3:26 PM

    Hello Henry,

    Before we begin a SW deep dive can I ask you to provide the method by which you got to this C++ codebase? If parts of this codebase are auto-generated by TES then perhaps the issue lies there instead.

    Once we've confirmed your methods and can replicate your issue we'll begin finding solutions.

    Best Regards,
    Oisín.

Reply
  • 0
    •  Analog Employees 
    on Jul 6, 2021 3:26 PM

    Hello Henry,

    Before we begin a SW deep dive can I ask you to provide the method by which you got to this C++ codebase? If parts of this codebase are auto-generated by TES then perhaps the issue lies there instead.

    Once we've confirmed your methods and can replicate your issue we'll begin finding solutions.

    Best Regards,
    Oisín.

Children
No Data