This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Decimation on STM32 Eval board

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.

Parents
  • Hi selwyn123,

    The ADC data can be directly converted from integer to floating-point without going to Q fractional data format. You are taking unnecessary steps with uint32_t to q31_t then q31_t to float32_t.

    You are in control of the ADC, what is your reason for decimating the ADC values? Do you want to process your ADC data through various sampling rates? If you just want to downsample, you should try first if you can arrive at the required sampling rate by altering the sampling clock of the ADC. If that is possible you don't have to perform the decimation and avoid the computations involved.

    Regards,

    Goodwin

Reply
  • Hi selwyn123,

    The ADC data can be directly converted from integer to floating-point without going to Q fractional data format. You are taking unnecessary steps with uint32_t to q31_t then q31_t to float32_t.

    You are in control of the ADC, what is your reason for decimating the ADC values? Do you want to process your ADC data through various sampling rates? If you just want to downsample, you should try first if you can arrive at the required sampling rate by altering the sampling clock of the ADC. If that is possible you don't have to perform the decimation and avoid the computations involved.

    Regards,

    Goodwin

Children
No data