1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-15 01:23:49 +01:00
bors[bot] f08ab0814c
Merge #19629
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>
2023-05-28 05:23:29 +00:00
..
2023-01-08 22:26:12 +01:00
2023-01-08 22:26:12 +01:00
2023-05-20 15:42:00 +00:00
2023-01-08 22:26:12 +01:00
2023-01-08 22:26:12 +01:00
2023-01-08 22:26:12 +01:00
2023-05-02 18:08:42 +00:00
2023-01-08 22:26:12 +01:00
2023-01-08 22:26:12 +01:00
2023-05-24 09:53:23 +02:00
2023-01-08 22:26:12 +01:00
2023-05-28 05:23:29 +00:00
2021-07-09 10:47:42 +02:00