1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/stm32l4+/wb: centralize max core clock define, adapt related boards

This commit is contained in:
Alexandre Abadie 2020-10-22 08:48:04 +02:00
parent 05f67a0a00
commit ec5b47fc61
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
5 changed files with 24 additions and 20 deletions

View File

@ -19,11 +19,7 @@
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#include "periph_cpu.h"
/* Add specific clock configuration (HSE, LSE) for this board here */
#define CLOCK_CORECLOCK_MAX MHZ(120)
#ifndef CONFIG_BOARD_HAS_LSE
#define CONFIG_BOARD_HAS_LSE 1
#endif
@ -32,7 +28,8 @@
#define CONFIG_CLOCK_PLL_N (30)
#endif
#include "l4/cfg_clock_default.h"
#include "periph_cpu.h"
#include "clk_conf.h"
#include "cfg_i2c1_pb8_pb9.h"
#include "cfg_rtt_default.h"

View File

@ -20,9 +20,7 @@
#define PERIPH_CONF_H
/* Add specific clock configuration (HSE, LSE) for this board here */
#define CLOCK_CORECLOCK_MAX MHZ(110)
/* Reach 108MHz by by default setting custom PLL_N factor */
/* Reach 108MHz by default by setting custom PLL_N factor */
#ifndef CONFIG_CLOCK_PLL_N
#define CONFIG_CLOCK_PLL_N 27
#endif
@ -33,7 +31,7 @@
#endif
#include "periph_cpu.h"
#include "l4/cfg_clock_default.h"
#include "clk_conf.h"
#include "cfg_i2c1_pb8_pb9.h"
#include "cfg_rtt_default.h"
#include "cfg_timer_tim5.h"

View File

@ -20,11 +20,7 @@
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#include "periph_cpu.h"
/* Add specific clock configuration (HSE, LSE) for this board here */
#define CLOCK_CORECLOCK_MAX MHZ(64)
#ifndef CONFIG_BOARD_HAS_LSE
#define CONFIG_BOARD_HAS_LSE 1
#endif
@ -39,8 +35,8 @@
#define CLOCK_EXTAHB_DIV RCC_EXTCFGR_C2HPRE_3
#define CLOCK_EXTAHB (CLOCK_CORECLOCK / 2)
#include "l4/cfg_clock_default.h"
#include "periph_cpu.h"
#include "clk_conf.h"
#include "cfg_i2c1_pb8_pb9.h"
#include "cfg_rtt_default.h"
#include "cfg_timer_tim2.h"

View File

@ -37,7 +37,7 @@
#include "l0l1/cfg_clock_default.h"
#elif defined(CPU_FAM_STM32L4) || defined(CPU_FAM_STM32L5) || \
defined(CPU_FAM_STM32WB)
#include "l4/cfg_clock_default.h"
#include "l4l5wb/cfg_clock_default.h"
#else
#error "No clock configuration available"
#endif

View File

@ -18,8 +18,8 @@
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef CLK_L4_CFG_CLOCK_DEFAULT_H
#define CLK_L4_CFG_CLOCK_DEFAULT_H
#ifndef CLK_L4L5WB_CFG_CLOCK_DEFAULT_H
#define CLK_L4L5WB_CFG_CLOCK_DEFAULT_H
#ifdef __cplusplus
extern "C" {
@ -167,9 +167,22 @@ extern "C" {
*/
#define CLOCK_CORECLOCK \
((CLOCK_PLL_SRC / CONFIG_CLOCK_PLL_M) * CONFIG_CLOCK_PLL_N) / CONFIG_CLOCK_PLL_R
#ifndef CLOCK_CORECLOCK_MAX
/* Set max allowed sysclk */
#if defined(CPU_FAM_STM32WB)
#define CLOCK_CORECLOCK_MAX MHZ(64)
#elif defined(CPU_FAM_STM32L5)
#define CLOCK_CORECLOCK_MAX MHZ(110)
#elif defined(CPU_LINE_STM32L4A6xx) || defined(CPU_LINE_STM32L4P5xx) || \
defined(CPU_LINE_STM32L4Q5xx) || defined(CPU_LINE_STM32L4R5xx) || \
defined(CPU_LINE_STM32L4R7xx) || defined(CPU_LINE_STM32L4R9xx) || \
defined(CPU_LINE_STM32L4S5xx) || defined(CPU_LINE_STM32L4S7xx) || \
defined(CPU_LINE_STM32L4S9xx)
#define CLOCK_CORECLOCK_MAX MHZ(120)
#else /* all the other L4 */
#define CLOCK_CORECLOCK_MAX MHZ(80)
#endif
#if CLOCK_CORECLOCK > CLOCK_CORECLOCK_MAX
#if CLOCK_CORECLOCK_MAX == MHZ(64)
#error "SYSCLK cannot exceed 64MHz"
@ -200,5 +213,5 @@ extern "C" {
}
#endif
#endif /* CLK_L4_CFG_CLOCK_DEFAULT_H */
#endif /* CLK_L4L5WB_CFG_CLOCK_DEFAULT_H */
/** @} */