cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP15x ADC Oversample

Macdog
Associate III

Could someone point me to some documentation about how to control the oversampling for ADC1 and ADC2 for the STM32MP157C?    Using OpenSTLinux 4.1.0, buildroot.   I looked around but couldn't find anything.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Kevin HUBER
ST Employee

Hello @Macdog ,

To enable the oversampling you have to modify the register ADC_CFGR2. The description of this register is visible in the Reference manual (RM0436 rev 6) chapter 29.6.5 ADC configuration register 2 (ADC_CFGR2).

The bits related to Oversampling are

Bits 25:16 OSVR[9:0]: Oversampling ratio

 

By default it is set to 0, but you can modify this value to go up to 1024x. Usually an oversampling of x16 is already enough to reduce the noise.

---

U-Boot and Linux

Are you working under U-Boot or Linux?

If you are using the ADC in Linux, as visible in the "Documentation/devicetree/bindings/iio/adc/adc.yaml" you can configure the oversampling ratio directly from the DTS by using the property:

oversampling-ratio

 

M4 only

You also have an example for M4 only in the STM32CubeMP1_Package in the example "ADC_OverSampler". In this example for STM32MP157C-EV1 board, the oversampling ratio is configured to x1024. You can read the readme to have more information regarding this example:

https://wiki.st.com/stm32mpu/wiki/STM32CubeMP1_Package_release_note_-_v1.6.0

 

You can download the STM32CubeMP1_Package on the wiki : https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-EV1/Develop_on_Arm%C2%AE_Cortex%C2%AE-M4/Install_STM32CubeMP1_package

More general information

Finally if you want more additional information, but more generic one, you can read the AN2834 that provides information to have accurate measure in ADC: https://www.st.com/resource/en/application_note/CD00211314-.pdf

Hope it helps,

Best Regards,

Kevin

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
Kevin HUBER
ST Employee

Hello @Macdog ,

To enable the oversampling you have to modify the register ADC_CFGR2. The description of this register is visible in the Reference manual (RM0436 rev 6) chapter 29.6.5 ADC configuration register 2 (ADC_CFGR2).

The bits related to Oversampling are

Bits 25:16 OSVR[9:0]: Oversampling ratio

 

By default it is set to 0, but you can modify this value to go up to 1024x. Usually an oversampling of x16 is already enough to reduce the noise.

---

U-Boot and Linux

Are you working under U-Boot or Linux?

If you are using the ADC in Linux, as visible in the "Documentation/devicetree/bindings/iio/adc/adc.yaml" you can configure the oversampling ratio directly from the DTS by using the property:

oversampling-ratio

 

M4 only

You also have an example for M4 only in the STM32CubeMP1_Package in the example "ADC_OverSampler". In this example for STM32MP157C-EV1 board, the oversampling ratio is configured to x1024. You can read the readme to have more information regarding this example:

https://wiki.st.com/stm32mpu/wiki/STM32CubeMP1_Package_release_note_-_v1.6.0

 

You can download the STM32CubeMP1_Package on the wiki : https://wiki.st.com/stm32mpu/wiki/Getting_started/STM32MP1_boards/STM32MP157x-EV1/Develop_on_Arm%C2%AE_Cortex%C2%AE-M4/Install_STM32CubeMP1_package

More general information

Finally if you want more additional information, but more generic one, you can read the AN2834 that provides information to have accurate measure in ADC: https://www.st.com/resource/en/application_note/CD00211314-.pdf

Hope it helps,

Best Regards,

Kevin

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.