aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-12-13 00:07:20 -0500
committerKevin O'Connor <kevin@koconnor.net>2023-01-17 18:22:21 -0500
commit876c3ffffdce78b1cdc976b572fe1eca9b97fe44 (patch)
tree90913cfe7c604849a22bddcb7c61f1c90f36ee50 /src/stm32
parentefdc29f5892e2da869ae1c0038f8b3cc8dc23d5c (diff)
downloadkutter-876c3ffffdce78b1cdc976b572fe1eca9b97fe44.tar.gz
kutter-876c3ffffdce78b1cdc976b572fe1eca9b97fe44.tar.xz
kutter-876c3ffffdce78b1cdc976b572fe1eca9b97fe44.zip
stm32: No need to use hardware oversampling in stm32h7_adc.c
Not all chips implement hardware oversampling. The software already implements oversampling, and additional hardware oversampling is unlikely to improve results. Remove the hardware oversampling to simplify the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32')
-rw-r--r--src/stm32/stm32h7_adc.c25
1 files changed, 0 insertions, 25 deletions
diff --git a/src/stm32/stm32h7_adc.c b/src/stm32/stm32h7_adc.c
index 61e0c764..3100d205 100644
--- a/src/stm32/stm32h7_adc.c
+++ b/src/stm32/stm32h7_adc.c
@@ -24,11 +24,6 @@
#if CONFIG_MACH_STM32H723
#define PCSEL PCSEL_RES0
#endif
-
- // Number of samples is 2^OVERSAMPLES_EXPONENT (exponent can be 0-10)
- #define OVERSAMPLES_EXPONENT 3
- #define OVERSAMPLES (1 << OVERSAMPLES_EXPONENT)
-
#elif CONFIG_MACH_STM32L4
#define ADCIN_BANK_SIZE (19)
#define RCC_AHBENR_ADC (RCC->AHB2ENR)
@@ -37,9 +32,6 @@
#define ADC_ATICKS (0b100)
#define ADC_RES (0b00)
#define ADC_TS (ADC12_COMMON)
-
- #define OVERSAMPLES (0)
-
#elif CONFIG_MACH_STM32G4
#define ADCIN_BANK_SIZE (19)
#define RCC_AHBENR_ADC (RCC->AHB2ENR)
@@ -49,8 +41,6 @@
#define ADC_RES (0b00)
#define ADC_TS (ADC12_COMMON)
#define ADC_CCR_TSEN (ADC_CCR_VSENSESEL)
-
- #define OVERSAMPLES (0)
#endif
#define ADC_TEMPERATURE_PIN 0xfe
@@ -301,21 +291,6 @@ gpio_adc_setup(uint32_t pin)
if (!is_stm32h723_adc3) {
MODIFY_REG(adc->CFGR, ADC_CFGR_RES_Msk, ADC_RES<<ADC_CFGR_RES_Pos);
}
-#if CONFIG_MACH_STM32H7
- // Set hardware oversampling
- MODIFY_REG(adc->CFGR2, ADC_CFGR2_ROVSE_Msk, ADC_CFGR2_ROVSE);
- if (is_stm32h723_adc3) {
-#ifdef ADC3_CFGR2_OVSR
- MODIFY_REG(adc->CFGR2, ADC3_CFGR2_OVSR_Msk,
- (OVERSAMPLES_EXPONENT - 1) << ADC3_CFGR2_OVSR_Pos);
-#endif
- } else {
- MODIFY_REG(adc->CFGR2, ADC_CFGR2_OVSR_Msk,
- (OVERSAMPLES - 1) << ADC_CFGR2_OVSR_Pos);
- }
- MODIFY_REG(adc->CFGR2, ADC_CFGR2_OVSS_Msk,
- OVERSAMPLES_EXPONENT << ADC_CFGR2_OVSS_Pos);
-#endif
}
if (pin == ADC_TEMPERATURE_PIN) {