I see that the MPC5676R decimator has an integrator block. I am trying to figure out how the device works. In my example assume unsigned a numbers from an ADC. I need to average a number of samples over a period. I plan to have the eTPU trigger the ZSEL field, the rising edge of a pulse. I am assuming that the integrator works in the following way.
ADC values are forwarded to the Integrator. The integrator will maintain an running average over some time period defined by the first trigger of the ZSEL to the second trigger of the ZSEL.
When the ZSEL is triggered two data points are given. The number data samples accumulated over the period and the average for the samples.
One last question to make sure I understand this and thanks for your help.
What is throwing me is that "CINTVAL" is signed fixed register with the fraction part in the lower 15-bits. So from your example above, if I enable the filter scaling factor to 16 and set C0 to 1 with all of the other coefficients set to zero and since I am oversampling my signal by a factor of 16 the fractional part of my average would be in the lower 15-bits.
If I just did a pass through to the integrator I would basically have a 17-bit sum register.
I see that I didn't ask my real question. Is the integrator keeping a running average over the time period? So if I had five samples of 2, 3, 4,5, 10 the value stored in "CINTVAL" would be 4.8 not 24. I am just trying to figure out how the overflow would work with unsigned value being forwarded by the ADC to the integrator with respect to our worst scenario.
Thanks
No, integrator perform SUM operation with all results within the window. But if you have properly set decimation stage before this, you may get AVERAGE operation.
For instance if FIR filter is used with C0 as 1/16, other coefficients set as zero, then this filter only attenuate the signal. If integrator output request would be clocked with clock with 1/16 of ADC triggering clock, then you will obtain averaging of 16 samples.
But this construct seems to me too much complicated. I would rather choose some ordinary FIR filter or IIR filter and simply filter this signal by this (what’s however not averaging).
Yes, it is possible to use it this way.