Hello @RShar.9 ,
The example ADC_OverSampler available in the STM32CubeH7 package will help you to configure and use the ADC to convert an external
analog input combined with oversampling feature:
STM32Cube_FW_H7_V1.5.0\Projects\STM32H743I-EVAL\Examples\ADC\ADC_OverSampler
- For Oversampling ratio x4, you can add this lines before calling HAL_ADC_Init
hadc1.Init.OversamplingMode = ENABLE; /* Oversampling enabled */
hadc1.Init.Oversampling.Ratio = 3; /* Oversampling ratio */
hadc1.Init.Oversampling.RightBitShift = ADC_RIGHTBITSHIFT_2; /* Right shift of the oversampled summation */
hadc1.Init.Oversampling.TriggeredMode = ADC_TRIGGEREDMODE_SINGLE_TRIGGER; /* Specifies whether or not a trigger is needed for each sample */
hadc1.Init.Oversampling.OversamplingStopReset = ADC_REGOVERSAMPLING_CONTINUED_MODE; /* Specifies whether or not the oversampling buffer is maintained during injection sequence */
- For oversampling ratio x2, update these lines:
hadc1.Init.Oversampling.Ratio = 1; /* Oversampling ratio */
hadc1.Init.Oversampling.RightBitShift = ADC_RIGHTBITSHIFT_1; /* Right shift of the oversampled summation */
Hope this helps you.
Best Regards,
Imen
In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks