Skip to content

Commit

Permalink
stm32: Fix ADC on stm32h7 (#5239)
Browse files Browse the repository at this point in the history
Don't reset the ADC peripheral if the clock is already enabled.
Fixes #5236

Signed-off-by: Aaron DeLyser <bluwolf@gmail.com>
  • Loading branch information
adelyser authored Feb 6, 2022
1 parent 54646c7 commit 9174c02
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/stm32/stm32h7_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ gpio_adc_setup(uint32_t pin)
ADC_TypeDef *adc;
if (chan >= 40){
adc = ADC3;
enable_pclock(ADC3_BASE);
if (!is_enabled_pclock(ADC3_BASE)) {
enable_pclock(ADC3_BASE);
}
MODIFY_REG(ADC3_COMMON->CCR, ADC_CCR_CKMODE_Msk,
0b11 << ADC_CCR_CKMODE_Pos);
} else if (chan >= 20){
Expand Down

0 comments on commit 9174c02

Please sign in to comment.