 and integration rate 1:
The filter parameters should be carefully selected to achieve the desired output bit-depth and sampling frequency.
When using DFSDM for audio applications, in conjunction with the optional audio processing filters, care should be taken to ensure that samples result in a 24-bit value. The ‘audio packing’ filter DFSDM_PACK_AUDIO assumes a 24-bit signed input, and will produce confusing results if this is not the case.
The following table shows how choice of the filter order and decimation rate affect the maximum value that can be sampled:
|dOSR||fORD = 0||fORD = 1||fORD = 2||fORD = 3||fORD = 4||fORD = 5|
The integration parameter iOSR also has an effect on the maximum sample value, and values from the table should be multiplied by iOSR to determine this value. For example, a third-order filter with a decimation rate of 64 and an integration rate of 64 would achieve the following maximum sample value:
Note that the right-shift parameter can be useful when large maximum values are achieved, in order to bring the result back into the range of a 24-bit value. For example, a fifth-order filter with decimation rate 32 and integration rate 2 will produce a maximum value of 67,108,864. By specifying 2 as the right-shift value, after the integration rate has been applied, samples will be divided by 4, resulting in a maximum sample of 16,777,216.
Please note that if you wish to make use of dfsdm, you will not be able to make simultaneous use of spiAHSR, and vice versa. This is due to the way these objects make use of DMA. The imp004m’s spiGJKL is unaffected by this limitation. It is possible to use the two objects within your application, but your code will need to ensure they are not used at the same time.
You cannot call dfsdm.configure() while spiAHSR is configured and enabled, so if you are making use of this SPI bus, you should call spiAHSR.disable() before calling dfsdm.configure(). Equally, if you are using dfsdm and need to then make use of spiAHSR, you will need to call dfsdm.stop() (to send the current buffer to the buffer-processing callback) and dfsdm.reset() (to disable the dfsdm) before calling spiAHSR.configure().
If you attempt to configure dfsdm while spiAHSR is in use, the following error will be thrown:
“cannot configure dfsdm whilst spiAHSR is in use in dfsdm.configure(filterOrder, decimation, integration, offset, rightShift, samplingEdge, buffers, callback[, processors])”. If you attempt to configure spiAHSR while dfsdm is in use, the following error will be thrown:
“cannot configure spiAHSR whilst dfsdm is in use in spi.configure(flags, rateKHz)”.
The dfsdm object has the following member methods: