From dd8eec540ab28744c01e1c7fcb5ed76bff9a24f5 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 31 Aug 2020 10:48:52 +0200 Subject: [PATCH] boards/stm32f3*: adapt to new clock configuration --- boards/nucleo-f302r8/include/periph_conf.h | 9 ++++++++- boards/nucleo-f303k8/include/periph_conf.h | 14 ++++++++------ boards/nucleo-f303re/include/periph_conf.h | 9 ++++++++- boards/nucleo-f303ze/include/periph_conf.h | 9 ++++++++- boards/nucleo-f334r8/include/periph_conf.h | 9 ++++++++- boards/stm32f3discovery/include/periph_conf.h | 5 +++++ 6 files changed, 45 insertions(+), 10 deletions(-) diff --git a/boards/nucleo-f302r8/include/periph_conf.h b/boards/nucleo-f302r8/include/periph_conf.h index 034fcde657..7c53151786 100644 --- a/boards/nucleo-f302r8/include/periph_conf.h +++ b/boards/nucleo-f302r8/include/periph_conf.h @@ -24,7 +24,14 @@ #define PERIPH_CONF_H /* This board provides an LSE */ -#define CLOCK_LSE (1) +#ifndef CONFIG_BOARD_HAS_LSE +#define CONFIG_BOARD_HAS_LSE 1 +#endif + +/* This board provides an HSE */ +#ifndef CONFIG_BOARD_HAS_HSE +#define CONFIG_BOARD_HAS_HSE 1 +#endif #include "periph_cpu.h" #include "f1f3/cfg_clock_default.h" diff --git a/boards/nucleo-f303k8/include/periph_conf.h b/boards/nucleo-f303k8/include/periph_conf.h index c170c01ced..608ec4f06d 100644 --- a/boards/nucleo-f303k8/include/periph_conf.h +++ b/boards/nucleo-f303k8/include/periph_conf.h @@ -19,12 +19,14 @@ #ifndef PERIPH_CONF_H #define PERIPH_CONF_H -/* No HSE available for this board */ -#define CLOCK_HSE (0U) - -/* Adjust PLL prescalers to reach 72MHz sysclock */ -#define CLOCK_PLL_PREDIV (2) -#define CLOCK_PLL_MUL (16) +/* Adjust PLL factors: + - On nucleo-f303k8, there's no HSE and PREDIV is hard-wired to 2 + - to reach the maximum possible system clock (64MHz) set PLL_MUL to 16 + so system clock = (HSI8 / 2) * 16 = 64MHz */ +#define CONFIG_CLOCK_PLL_PREDIV (2) +#ifndef CONFIG_CLOCK_PLL_MUL +#define CONFIG_CLOCK_PLL_MUL (16) +#endif #include "periph_cpu.h" #include "f1f3/cfg_clock_default.h" diff --git a/boards/nucleo-f303re/include/periph_conf.h b/boards/nucleo-f303re/include/periph_conf.h index f21a70f427..1216a36066 100644 --- a/boards/nucleo-f303re/include/periph_conf.h +++ b/boards/nucleo-f303re/include/periph_conf.h @@ -22,7 +22,14 @@ #define PERIPH_CONF_H /* This board provides an LSE */ -#define CLOCK_LSE (1) +#ifndef CONFIG_BOARD_HAS_LSE +#define CONFIG_BOARD_HAS_LSE 1 +#endif + +/* This board provides an HSE */ +#ifndef CONFIG_BOARD_HAS_HSE +#define CONFIG_BOARD_HAS_HSE 1 +#endif #include "periph_cpu.h" #include "f1f3/cfg_clock_default.h" diff --git a/boards/nucleo-f303ze/include/periph_conf.h b/boards/nucleo-f303ze/include/periph_conf.h index d3268c00a4..fe85132044 100644 --- a/boards/nucleo-f303ze/include/periph_conf.h +++ b/boards/nucleo-f303ze/include/periph_conf.h @@ -20,7 +20,14 @@ #define PERIPH_CONF_H /* This board provides an LSE */ -#define CLOCK_LSE (1) +#ifndef CONFIG_BOARD_HAS_LSE +#define CONFIG_BOARD_HAS_LSE 1 +#endif + +/* This board provides an HSE */ +#ifndef CONFIG_BOARD_HAS_HSE +#define CONFIG_BOARD_HAS_HSE 1 +#endif #include "periph_cpu.h" #include "f1f3/cfg_clock_default.h" diff --git a/boards/nucleo-f334r8/include/periph_conf.h b/boards/nucleo-f334r8/include/periph_conf.h index c279fc6ce2..0064365d99 100644 --- a/boards/nucleo-f334r8/include/periph_conf.h +++ b/boards/nucleo-f334r8/include/periph_conf.h @@ -21,7 +21,14 @@ #define PERIPH_CONF_H /* This board provides an LSE */ -#define CLOCK_LSE (1) +#ifndef CONFIG_BOARD_HAS_LSE +#define CONFIG_BOARD_HAS_LSE 1 +#endif + +/* This board provides an HSE */ +#ifndef CONFIG_BOARD_HAS_HSE +#define CONFIG_BOARD_HAS_HSE 1 +#endif #include "periph_cpu.h" #include "f1f3/cfg_clock_default.h" diff --git a/boards/stm32f3discovery/include/periph_conf.h b/boards/stm32f3discovery/include/periph_conf.h index 1b6f6cb6aa..c794d365b0 100644 --- a/boards/stm32f3discovery/include/periph_conf.h +++ b/boards/stm32f3discovery/include/periph_conf.h @@ -19,6 +19,11 @@ #ifndef PERIPH_CONF_H #define PERIPH_CONF_H +/* This board provides an HSE */ +#ifndef CONFIG_BOARD_HAS_HSE +#define CONFIG_BOARD_HAS_HSE 1 +#endif + #include "periph_cpu.h" #include "f1f3/cfg_clock_default.h"