On 02.05.2018 16:43, Pierre-Louis Bossart wrote:
+ /* Calculate CIC shift from the decimation factor specific gain. + */ + mcic = cfg->mcic; + g_cic = mcic * mcic * mcic * mcic * mcic;
yikes, what is this mcic^5 ?
Yep, it's the gain for +1 / -1 PDM bits in CIC decimator part. It's needed to set the scaling HW shifter. It also gives some idea of oversampling ratios to use for a microphone to get some # of bits of resolution as PCM code.
I meant: where does this ^5 come from? First time i see this sort of formula in filter design.
I see now -- There's a 5th order integrator-comb filter as 1st decimation filter stage for the PDM bits. Wikipedia has nowadays everything:
https://en.wikipedia.org/wiki/Cascaded_integrator%E2%80%93comb_filter
The high DC gain is caused by the integration part. The 1st equation with the Sigma statement shows the transfer function. By setting R=mcic, N=5, omega = 0 the same DC gain formula that I used is achieved.
Cheers, Seppo