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

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

boards/common/stm32: rework common clock configuration for stm32f4
This commit is contained in:
MichelRottleuthner 2019-03-04 14:10:47 +01:00 committed by GitHub
commit 1642a03125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 107 additions and 28 deletions

View File

@ -0,0 +1,41 @@
/*
* 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 */
/** @} */

View File

@ -11,7 +11,7 @@
* @{
*
* @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>
*/
@ -19,40 +19,19 @@
#ifndef 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
extern "C" {
#endif
/**
* @name Clock settings
* @brief LSE clock settings
*
* @note This is auto-generated from
* `cpu/stm32_common/dist/clk_conf/clk_conf.c`
* @{
* 0: no external low speed crystal available,
* 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)
/* 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
}

View File

@ -0,0 +1,59 @@
/*
* 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 */
/** @} */

View File

@ -21,7 +21,7 @@
#define PERIPH_CONF_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"
#ifdef __cplusplus