mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
f08ab0814c
19629: cpu/stm32/periph/adc: fix setting ADC clock r=benpicco a=Enoch247 ### Contribution description The current implementation uses the core clock frequency to calculate the needed prescalar to achieve a given ADC clock frequency. This is incorrect. This patch fixes the calculation to use the correct source clock (PCKLK2 ie APB2). It also changes the defined max clock rate to use the frequency macro to improve readability. I based on code similarity. I believe the gd32v CPU may need this same fix, but I am not familiar with that MCU. ### Testing procedure I tested this on a nucleo-f767zi. The the MCU's reference manual is in agreement with what I have implemented here. I spot checked references manuals for a random [STM32F1](https://www.st.com/resource/en/reference_manual/cd00171190-stm32f101xx-stm32f102xx-stm32f103xx-stm32f105xx-and-stm32f107xx-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf) and [STM32F2](https://www.st.com/resource/en/reference_manual/rm0033-stm32f205xx-stm32f207xx-stm32f215xx-and-stm32f217xx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf), and they are clocked similar to the F7 I have. ### Issues/PRs references None known. Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com> |
||
---|---|---|
.. | ||
arm7_common | ||
atmega32u4 | ||
atmega128rfa1 | ||
atmega256rfr2 | ||
atmega328p | ||
atmega1281 | ||
atmega1284p | ||
atmega2560 | ||
atmega_common | ||
atxmega | ||
avr8_common | ||
cc26x0_cc13x0 | ||
cc26x2_cc13x2 | ||
cc26xx_cc13xx | ||
cc2538 | ||
cortexm_common | ||
efm32 | ||
esp32 | ||
esp8266 | ||
esp_common | ||
fe310 | ||
gd32v | ||
kinetis | ||
lm4f120 | ||
lpc23xx | ||
lpc1768 | ||
msp430_common | ||
msp430fxyz | ||
native | ||
nrf5x_common | ||
nrf51 | ||
nrf52 | ||
nrf9160 | ||
qn908x | ||
riscv_common | ||
rpx0xx | ||
sam0_common | ||
sam3 | ||
sam_common | ||
samd5x | ||
samd21 | ||
saml1x | ||
saml21 | ||
stellaris_common | ||
stm32 | ||
doc.txt | ||
Kconfig |