ad5941 ocp measurement

Hi, How can ad5941 measure the open circuit potential(OCP) between RE and WE(or AINx) before EIS measurement?

Parents Reply Children
  • 0
    •  Analog Employees 
    on May 9, 2021 7:58 PM in reply to bradchen

    Hi,

    Below is the open circuit result obtained by measuring current input by running AD5940_BATImpedance example:

    Hello AD5940-Build Time:00:28:16
    i: 1 Freq: 1.00 RcalVolt:(-4.000000,5.000000)
    i: 2 Freq: 1.44 RcalVolt:(0.000000,2.000000)
    i: 3 Freq: 2.07 RcalVolt:(0.000000,-2.000000)
    i: 4 Freq: 2.98 RcalVolt:(-2.000000,0.000000)
    i: 5 Freq: 4.28 RcalVolt:(-3.000000,-1.000000)
    i: 6 Freq: 6.16 RcalVolt:(2.000000,2.000000)
    i: 7 Freq: 8.86 RcalVolt:(-1.000000,-1.000000)
    i: 8 Freq: 12.74 RcalVolt:(2.000000,0.000000)
    i: 9 Freq: 18.33 RcalVolt:(-1.000000,-1.000000)
    i: 10 Freq: 26.37 RcalVolt:(1.000000,-2.000000)
    i: 11 Freq: 37.93 RcalVolt:(0.000000,0.000000)
    i: 12 Freq: 54.56 RcalVolt:(-1.000000,-1.000000)
    i: 13 Freq: 78.48 RcalVolt:(-2.000000,1.000000)
    i: 14 Freq: 112.88 RcalVolt:(0.000000,0.000000)
    i: 15 Freq: 162.38 RcalVolt:(0.000000,0.000000)
    i: 16 Freq: 233.57 RcalVolt:(0.000000,0.000000)
    i: 17 Freq: 335.98 RcalVolt:(0.000000,-1.000000)
    i: 18 Freq: 483.29 RcalVolt:(-5.000000,10.000000)
    i: 19 Freq: 695.19 RcalVolt:(7.000000,3.000000)
    i: 0 Freq: 1000.00 RcalVolt:(-1.000000,-4.000000)

    In AD5940-Impedance example,

    By setting

    pImpedanceCfg->ADCSinc3Osr = ADCSINC3OSR_5;//ADCSINC3OSR_2; and

    clk_cfg.HfOSC32MHzMode = bTRUE;//bFALSE;

    The following results are obtained from 20HZ to 100HZ. (with 700 Ohm resistor)

    Freq:19.05 RzMag: 692.232971 Ohm , RzPhase: 1.475751
    Freq:19.95 RzMag: 692.799744 Ohm , RzPhase: -1.111682
    Freq:20.89 RzMag: 680.045471 Ohm , RzPhase: -2.793056
    Freq:21.88 RzMag: 661.422974 Ohm , RzPhase: -3.216097
    Freq:22.91 RzMag: 645.959839 Ohm , RzPhase: -2.339729
    Freq:23.99 RzMag: 641.814575 Ohm , RzPhase: -0.642113
    Freq:25.12 RzMag: 651.756897 Ohm , RzPhase: 0.916017
    Freq:26.30 RzMag: 668.785034 Ohm , RzPhase: 1.602847
    Freq:27.54 RzMag: 685.240784 Ohm , RzPhase: 1.311895
    Freq:28.84 RzMag: 694.221558 Ohm , RzPhase: 0.339761
    Freq:30.20 RzMag: 692.621460 Ohm , RzPhase: -0.562610
    Freq:31.62 RzMag: 684.737183 Ohm , RzPhase: -0.894352
    Freq:33.11 RzMag: 678.146484 Ohm , RzPhase: -0.482382
    Freq:34.67 RzMag: 679.080505 Ohm , RzPhase: 0.215308
    Freq:36.31 RzMag: 686.552795 Ohm , RzPhase: 0.540739
    Freq:38.02 RzMag: 693.679321 Ohm , RzPhase: 0.280782
    Freq:39.81 RzMag: 694.289307 Ohm , RzPhase: -0.194708
    Freq:41.69 RzMag: 689.622375 Ohm , RzPhase: -0.371795
    Freq:43.65 RzMag: 687.199158 Ohm , RzPhase: -0.062749
    Freq:45.71 RzMag: 689.923523 Ohm , RzPhase: 0.250347
    Freq:47.86 RzMag: 694.028198 Ohm , RzPhase: 0.133161
    Freq:50.12 RzMag: 693.865723 Ohm , RzPhase: -0.177879
    Freq:52.48 RzMag: 691.126831 Ohm , RzPhase: -0.123374
    Freq:54.95 RzMag: 691.421021 Ohm , RzPhase: 0.137232
    Freq:57.54 RzMag: 693.953308 Ohm , RzPhase: 0.109119
    Freq:60.26 RzMag: 693.897888 Ohm , RzPhase: -0.116462
    Freq:63.10 RzMag: 692.540649 Ohm , RzPhase: -0.022710
    Freq:66.07 RzMag: 693.953796 Ohm , RzPhase: 0.082037
    Freq:69.18 RzMag: 694.391968 Ohm , RzPhase: -0.066963
    Freq:72.44 RzMag: 693.000854 Ohm , RzPhase: -0.005307
    Freq:75.86 RzMag: 693.917725 Ohm , RzPhase: 0.057995
    Freq:79.43 RzMag: 694.427185 Ohm , RzPhase: -0.043611
    Freq:83.18 RzMag: 693.465088 Ohm , RzPhase: -0.025996
    Freq:87.10 RzMag: 694.454224 Ohm , RzPhase: 0.043604
    Freq:91.20 RzMag: 693.962524 Ohm , RzPhase: -0.014548
    Freq:95.50 RzMag: 694.495117 Ohm , RzPhase: 0.010484
    Freq:100.00 RzMag: 694.465271 Ohm , RzPhase: -0.041118

    You may add 

    AD5940_AFEPwrBW(AFEPWR_LP, AFEBW_50KHZ)

    and Check for lower frequencies.

  • 0
    •  Analog Employees 
    on May 25, 2021 2:14 PM in reply to Akila

    You may Update AFE in interrupt handler using function

    AppAMPRegModify(pBuff, &FifoCnt);   

    as shown below:

    int32_t AppIMPRegModify(int32_t * const pData, uint32_t *pDataCount)
    {
    HSLoopCfg_Type HsLoopCfg;
    DSPCfg_Type dsp_cfg;
    CLKCfg_Type clk_cfg;
    float nextfreq;
    uint32_t WaitClks;
    ClksCalInfo_Type clks_cal;
    FreqParams_Type freq_params;
    uint32_t SeqCmdBuff[2];
    uint32_t SRAMAddr = 0;;


    if(AppIMPCfg.NumOfData > 0)
    {
    AppIMPCfg.FifoDataCount += *pDataCount/4;
    if(AppIMPCfg.FifoDataCount >= AppIMPCfg.NumOfData)
    {
    AD5940_WUPTCtrl(bFALSE);
    return AD5940ERR_OK;
    }
    }
    if(AppIMPCfg.SweepCfg.SweepEn) /* Need to set new frequency and set power mode */
    {
    AD5940_WGFreqCtrlS(AppIMPCfg.SweepNextFreq, AppIMPCfg.SysClkFreq);
    }


    AppIMPCtrl(IMPCTRL_GETFREQ, &nextfreq);
    freq_params = AD5940_GetFreqParameters(nextfreq);

    if (nextfreq<0.11)
    {

    AppIMPCfg.PwrMod = AFEPWR_LP;
    AD5940_AFEPwrBW(AppIMPCfg.PwrMod, AFEBW_250KHZ);
    AppIMPCfg.HsDacUpdateRate = 27;

    }
    else if(nextfreq<0.51)
    {
    AppIMPCfg.PwrMod = AFEPWR_LP;
    AD5940_AFEPwrBW(AppIMPCfg.PwrMod, AFEBW_250KHZ);
    AppIMPCfg.HsDacUpdateRate = 27;

    }
    else if(nextfreq<20)
    {
    AppIMPCfg.PwrMod = AFEPWR_LP;
    AD5940_AFEPwrBW(AppIMPCfg.PwrMod, AFEBW_50KHZ);
    AppIMPCfg.HsDacUpdateRate = 27;

    }
    else if(nextfreq<450)
    {
    AppIMPCfg.PwrMod = AFEPWR_LP;
    AD5940_AFEPwrBW(AppIMPCfg.PwrMod, AFEBW_250KHZ);
    AppIMPCfg.HsDacUpdateRate = 27;


    }
    else if(nextfreq<80000)
    {
    AppIMPCfg.PwrMod = AFEPWR_LP;
    AD5940_AFEPwrBW(AppIMPCfg.PwrMod, AFEBW_250KHZ);
    AppIMPCfg.HsDacUpdateRate = 27;

    }
    else if(nextfreq<=200000)
    {
    AppIMPCfg.PwrMod = AFEPWR_HP;
    AD5940_AFEPwrBW(AppIMPCfg.PwrMod, AFEBW_250KHZ);
    //clk_cfg.SysClkDiv = SYSCLKDIV_2;
    clk_cfg.HfOSC32MHzMode = bTRUE;

    AppIMPCfg.HsDacUpdateRate = 7;

    }

    HsLoopCfg.HsDacCfg.HsDacUpdateRate = AppIMPCfg.HsDacUpdateRate;
    dsp_cfg.ADCFilterCfg.ADCSinc2Osr = freq_params.ADCSinc2Osr;
    dsp_cfg.ADCFilterCfg.ADCSinc3Osr = freq_params.ADCSinc3Osr;
    dsp_cfg.DftCfg.DftNum =freq_params.DftNum;
    dsp_cfg.DftCfg.DftSrc = freq_params.DftSrc;

    AD5940_CLKCfg(&clk_cfg);
    AD5940_HSLoopCfgS(&HsLoopCfg);
    memset(&dsp_cfg.StatCfg, 0, sizeof(dsp_cfg.StatCfg));
    AD5940_DSPCfgS(&dsp_cfg);

    /* Step 3: Calculate clocks needed to get result to FIFO and update sequencer wait command */
    clks_cal.DataType = DATATYPE_DFT;
    clks_cal.DftSrc = freq_params.DftSrc;
    clks_cal.DataCount = 1L<<(freq_params.DftNum+2); /* 2^(DFTNUMBER+2) */
    clks_cal.ADCSinc2Osr = freq_params.ADCSinc2Osr;
    clks_cal.ADCSinc3Osr = freq_params.ADCSinc3Osr;
    clks_cal.ADCAvgNum = 0;
    clks_cal.RatioSys2AdcClk = AppIMPCfg.SysClkFreq/AppIMPCfg.AdcClkFreq;
    AD5940_ClksCalculate(&clks_cal, &WaitClks);

    /* Maximum number of clocks is 0x3FFFFFFF. More are needed if the frequency is low */
    if(WaitClks > 0x3FFFFFFF)
    {
    WaitClks /=2;
    SRAMAddr = AppIMPCfg.MeasureSeqInfo.SeqRamAddr;
    SeqCmdBuff[0] = SEQ_WAIT(WaitClks);
    AD5940_SEQCmdWrite(SRAMAddr+11, SeqCmdBuff, 1);
    AD5940_SEQCmdWrite(SRAMAddr+12, SeqCmdBuff, 1);
    AD5940_SEQCmdWrite(SRAMAddr+18, SeqCmdBuff, 1);
    AD5940_SEQCmdWrite(SRAMAddr+19, SeqCmdBuff, 1);
    }
    else
    {
    SRAMAddr = AppIMPCfg.MeasureSeqInfo.SeqRamAddr;
    SeqCmdBuff[0] = SEQ_WAIT(WaitClks);
    AD5940_SEQCmdWrite(SRAMAddr+11, SeqCmdBuff, 1);
    AD5940_SEQCmdWrite(SRAMAddr+18, SeqCmdBuff, 1);
    }

    if(AppIMPCfg.StopRequired == bTRUE)
    {
    AD5940_WUPTCtrl(bFALSE);
    return AD5940ERR_OK;
    }

    return AD5940ERR_OK;
    }

    You may refer to AppBIOZCheckFreq() in AD5940_BIOZ_2_Wire code 

    ad5940-examples/BIOZ-2Wire.c at master · analogdevicesinc/ad5940-examples · GitHub