Skip to content
Snippets Groups Projects
Unverified Commit 1642a031 authored by MichelRottleuthner's avatar MichelRottleuthner Committed by GitHub
Browse files

Merge pull request #11066 from aabadie/pr/boards/common_f4_clock

boards/common/stm32: rework common clock configuration for stm32f4
parents 622645d0 a5ff1dc3
No related branches found
No related tags found
No related merge requests found
/*
* Copyright (C) 2018 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_common_stm32
* @{
*
* @file
* @brief Configure STM32F4 clock to 168MHz using PLL and without LSE
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef F4_CFG_CLOCK_168_8_0_H
#define F4_CFG_CLOCK_168_8_0_H
#include "f4/cfg_clock_168_8_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief LSE clock settings
*
* 0: no external low speed crystal available,
* 1: external crystal available (always 32.768kHz)
*/
#define CLOCK_LSE (0)
#ifdef __cplusplus
}
#endif
#endif /* F4_CFG_CLOCK_168_8_0_H */
/** @} */
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* @{ * @{
* *
* @file * @file
* @brief Configure STM32F4 clock to 168MHz using PLL * @brief Configure STM32F4 clock to 168MHz using PLL with LSE
* *
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/ */
...@@ -19,40 +19,19 @@ ...@@ -19,40 +19,19 @@
#ifndef F4_CFG_CLOCK_168_8_1_H #ifndef F4_CFG_CLOCK_168_8_1_H
#define F4_CFG_CLOCK_168_8_1_H #define F4_CFG_CLOCK_168_8_1_H
#include "f4/cfg_clock_168_8_common.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
* @name Clock settings * @brief LSE clock settings
* *
* @note This is auto-generated from * 0: no external low speed crystal available,
* `cpu/stm32_common/dist/clk_conf/clk_conf.c` * 1: external crystal available (always 32.768kHz)
* @{
*/ */
/* give the target core clock (HCLK) frequency [in Hz],
* maximum: 168MHz */
#define CLOCK_CORECLOCK (168000000U)
/* 0: no external high speed crystal available
* else: actual crystal frequency [in Hz] */
#define CLOCK_HSE (8000000U)
/* 0: no external low speed crystal available,
* 1: external crystal available (always 32.768kHz) */
#define CLOCK_LSE (1) #define CLOCK_LSE (1)
/* peripheral clock setup */
#define CLOCK_AHB_DIV RCC_CFGR_HPRE_DIV1
#define CLOCK_AHB (CLOCK_CORECLOCK / 1)
#define CLOCK_APB1_DIV RCC_CFGR_PPRE1_DIV4 /* max 42MHz */
#define CLOCK_APB1 (CLOCK_CORECLOCK / 4)
#define CLOCK_APB2_DIV RCC_CFGR_PPRE2_DIV2 /* max 84MHz */
#define CLOCK_APB2 (CLOCK_CORECLOCK / 2)
/* Main PLL factors */
#define CLOCK_PLL_M (4)
#define CLOCK_PLL_N (168)
#define CLOCK_PLL_P (2)
#define CLOCK_PLL_Q (7)
/** @} */
#ifdef __cplusplus #ifdef __cplusplus
} }
......
/*
* Copyright (C) 2018 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_common_stm32
* @{
*
* @file
* @brief Configure STM32F4 clock to 168MHz using PLL
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef F4_CFG_CLOCK_168_8_COMMON_H
#define F4_CFG_CLOCK_168_8_COMMON_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Clock settings
*
* @note This is auto-generated from
* `cpu/stm32_common/dist/clk_conf/clk_conf.c`
* @{
*/
/* give the target core clock (HCLK) frequency [in Hz],
* maximum: 168MHz */
#define CLOCK_CORECLOCK (168000000U)
/* 0: no external high speed crystal available
* else: actual crystal frequency [in Hz] */
#define CLOCK_HSE (8000000U)
/* peripheral clock setup */
#define CLOCK_AHB_DIV RCC_CFGR_HPRE_DIV1
#define CLOCK_AHB (CLOCK_CORECLOCK / 1)
#define CLOCK_APB1_DIV RCC_CFGR_PPRE1_DIV4 /* max 42MHz */
#define CLOCK_APB1 (CLOCK_CORECLOCK / 4)
#define CLOCK_APB2_DIV RCC_CFGR_PPRE2_DIV2 /* max 84MHz */
#define CLOCK_APB2 (CLOCK_CORECLOCK / 2)
/* Main PLL factors */
#define CLOCK_PLL_M (4)
#define CLOCK_PLL_N (168)
#define CLOCK_PLL_P (2)
#define CLOCK_PLL_Q (7)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* F4_CFG_CLOCK_168_8_COMMON_H */
/** @} */
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#define PERIPH_CONF_H #define PERIPH_CONF_H
#include "periph_cpu.h" #include "periph_cpu.h"
#include "f4/cfg_clock_168_8_1.h" #include "f4/cfg_clock_168_8_0.h"
#include "cfg_spi_divtable.h" #include "cfg_spi_divtable.h"
#ifdef __cplusplus #ifdef __cplusplus
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment