1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00
RIOT/cpu/stm32
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
..
bootloader cpu/stm32: implement reset to bootloader 2020-06-05 18:41:06 +02:00
dist build-system: Allow out of tree BUILD_DIR 2023-05-16 22:23:03 +02:00
include Merge #19628 #19637 2023-05-21 06:04:07 +00:00
kconfigs cpu/stm32: Implement GPIO LL IRQ support for STM32F1 2023-03-22 10:40:25 +01:00
ldscripts cpu/{cortexm_common, stm32}: add support for backup RAM 2022-01-21 15:53:18 +01:00
periph Merge #19629 2023-05-28 05:23:29 +00:00
stmclk treewide/stm32: Make CLOCK_HS* configurable 2022-11-03 11:37:28 +01:00
vectors cpu/stm32: Add Kconfig dependency modeling 2021-07-02 15:11:05 +02:00
cpu_common.c cpu/stm32: make bus arg consistent 2023-05-19 10:44:24 -04:00
cpu_init.c cpu: call early_init() 2023-01-08 22:26:12 +01:00
doc.txt treewide/stm32: Make CLOCK_HS* configurable 2022-11-03 11:37:28 +01:00
Kconfig cpu/stm32/kconfig: rework clock tree 2022-11-03 11:37:33 +01:00
Makefile cpu/stm32: only build bootloader when the module is loaded 2020-09-28 21:07:01 +02:00
Makefile.cmsis build-system: Allow out of tree BUILD_DIR 2023-05-16 22:23:03 +02:00
Makefile.default cpu: make pm_layered a DEFAULT_MODULE 2021-01-27 13:21:20 +01:00
Makefile.dep cpu/stm32: improvement of USB driver selection 2022-11-03 13:52:01 +01:00
Makefile.features cpu/stm32: Implement GPIO LL IRQ support for STM32F1 2023-03-22 10:40:25 +01:00
Makefile.include build-system: Allow out of tree BUILD_DIR 2023-05-16 22:23:03 +02:00
stm32_info.mk cpu/stm32: add initial support for stm32u5 family 2021-12-23 11:04:41 +01:00
stm32_line.mk cpu/stm32: Add STM32_LINE cases for STM32L1xxx6 2022-03-01 17:20:16 +01:00
stm32_mem_lengths.mk cpu/stm32: fix RAM_LEN for F427, F429, F437, F439 models 2022-11-15 22:29:34 +01:00
stm32_riotboot.mk cpu/stm32: fix riotboot settings for L4 and WB 2023-05-23 17:47:04 +02:00
stm32.config cpu/stm32: Add Kconfig dependency modeling 2021-07-02 15:11:05 +02:00