I am trying to decimate my ADC values which are stored in a DMA buffer.
The functions I am using are:1. HAL_ADC_Start_DMA();2. arm_fir_decimate_init_f32();3. arm_fir_decimate_f32();
I understand that the information from the 12 bit ADC are stored in a uin32_t type buffer in the DMA. However, to decimate these values, which are in the range of 0-4096, it requires me to convert the uint32_t DMA values to a float32_t data type. I have tried casting the uint32_t values to a q31_t format and convert them to float32_t via the CMSIS lib: arm_q31_float, but to no avail. The output array of the decimation is always 0. May I have some help pertaining to either the conversion from uint32_t to q31_t format, or an alternative way to decimate uint32_t values.
Thank you.
looks good! you could also use a q15_t instead of q31_t if you'd like it to go a little faster. CMSIS takes advantage of SIMD for q15_t when it's available on specific targets. For targets without SIMD, it probably won't make a difference though. For q15_t just shift up 4 bits instead of 20.