Post Go back to editing

Mean filtering of SWV FIFO data

Category: Software
Product Number: AD5940
Software Version: NA

Using the ADCMeanFifo example: https://github.com/analogdevicesinc/ad5940-examples/blob/master/examples/AD5940_ADC/AD5940_ADCMeanFIFO.c

I tried modifying the SWV example in the SqrWaveVoltammetry.c AppSWVInit function with the following.

// Statistic block receive data from SINC2+Notch block. Note the diagram in datasheet page 51 PrM.
// The SINC3 can be bypassed optionally. SINC2 cannot be bypassed.
stat_cfg.StatDev = STATDEV_1; /* Not used. */
stat_cfg.StatEnable = bTRUE;
stat_cfg.StatSample = STATSAMPLE_8; /* Sample 64 points and calculate mean. */
AD5940_StatisticCfgS(&stat_cfg);

/* Reconfigure FIFO, The Rtia calibration function may generate data that stored to FIFO */
AD5940_FIFOCtrlS(FIFOSRC_SINC3, bFALSE); /* Disable FIFO firstly */
fifo_cfg.FIFOEn = bTRUE; /* We will enable FIFO after all parameters configured */
fifo_cfg.FIFOMode = FIFOMODE_FIFO;
fifo_cfg.FIFOSize = FIFOSIZE_4KB; /* 4kB for FIFO, The reset 4kB for sequencer */
// DEBUG: Try changing between SINC and MEAN
//fifo_cfg.FIFOSrc = FIFOSRC_SINC3;
fifo_cfg.FIFOSrc = FIFOSRC_MEAN;
fifo_cfg.FIFOThresh = AppSWVCfg.FifoThresh; /* Change FIFO paramters */
AD5940_FIFOCfg(&fifo_cfg);

If I leave the FIFOSrc set to FIFOSRC_SINC3, then I get normal data. If I change to FIFOSRC_MEAN then there is data (FIFO Count returns 0).  

What is the proper way to setup averaging/mean? 

Is it correct to assume that the mean calculation with take multiple samples back-to-back per the STATSAMPLE setting when triggered with SEQ2?  

Thanks!