2020-09-03 22:26:48 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Freie Universität Berlin
|
|
|
|
* 2017 OTA keys S.A.
|
|
|
|
* 2018-2020 Inria
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2020-10-21 19:20:57 +02:00
|
|
|
* @ingroup cpu_stm32
|
2020-09-03 22:26:48 +02:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Default STM32F4 clock configuration for 100MHz boards
|
|
|
|
*
|
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
|
|
* @author Vincent Dupont <vincent@otakeys.com>
|
|
|
|
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
|
|
|
*/
|
|
|
|
|
2020-10-21 19:20:57 +02:00
|
|
|
#ifndef CLK_F2F4F7_CFG_CLOCK_DEFAULT_100_H
|
|
|
|
#define CLK_F2F4F7_CFG_CLOCK_DEFAULT_100_H
|
2020-09-03 22:26:48 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name Clock PLL settings (100MHz)
|
|
|
|
* @{
|
|
|
|
*/
|
2020-09-18 09:53:49 +02:00
|
|
|
/* The following parameters configure a 100MHz system clock with HSE (8MHz, 16MHz or
|
|
|
|
25MHz) or HSI (16MHz) as PLL input clock.
|
|
|
|
If USB is used and no alternative 48MHz is available, the clock frequency is
|
|
|
|
decreased to 96MHZ so the PLLQ can output 48MHz.
|
|
|
|
*/
|
2020-09-03 22:26:48 +02:00
|
|
|
#ifndef CONFIG_CLOCK_PLL_M
|
2022-10-26 11:43:40 +02:00
|
|
|
#if IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(25))
|
2020-09-18 09:53:49 +02:00
|
|
|
#define CONFIG_CLOCK_PLL_M (25)
|
|
|
|
#else
|
2020-09-03 22:26:48 +02:00
|
|
|
#define CONFIG_CLOCK_PLL_M (4)
|
|
|
|
#endif
|
2020-09-18 09:53:49 +02:00
|
|
|
#endif
|
2020-09-03 22:26:48 +02:00
|
|
|
#ifndef CONFIG_CLOCK_PLL_N
|
2023-05-10 13:52:58 +02:00
|
|
|
#if (IS_USED(MODULE_PERIPH_USBDEV_CLK) || IS_USED(MODULE_PERIPH_SDMMC_CLK)) && \
|
|
|
|
defined(CPU_LINE_STM32F411xE)
|
2022-10-26 11:43:40 +02:00
|
|
|
#if IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(8))
|
2020-09-18 09:53:49 +02:00
|
|
|
#define CONFIG_CLOCK_PLL_N (96)
|
2022-10-26 11:43:40 +02:00
|
|
|
#elif IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(25))
|
2020-09-18 09:53:49 +02:00
|
|
|
#define CONFIG_CLOCK_PLL_N (192)
|
|
|
|
#else
|
|
|
|
#define CONFIG_CLOCK_PLL_N (48)
|
|
|
|
#endif
|
|
|
|
#else
|
2022-10-26 11:43:40 +02:00
|
|
|
#if IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(8))
|
2020-09-03 22:26:48 +02:00
|
|
|
#define CONFIG_CLOCK_PLL_N (100)
|
2022-10-26 11:43:40 +02:00
|
|
|
#elif IS_ACTIVE(CONFIG_BOARD_HAS_HSE) && (CONFIG_CLOCK_HSE == MHZ(25))
|
2020-09-18 09:53:49 +02:00
|
|
|
#define CONFIG_CLOCK_PLL_N (200)
|
2020-09-03 22:26:48 +02:00
|
|
|
#else
|
|
|
|
#define CONFIG_CLOCK_PLL_N (50)
|
|
|
|
#endif
|
2023-05-10 13:52:58 +02:00
|
|
|
#endif /* MODULE_PERIPH_USBDEV_CLK || MODULE_PERIPH_SDMMC_CLK */
|
2020-09-03 22:26:48 +02:00
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_CLOCK_PLL_P
|
|
|
|
#define CONFIG_CLOCK_PLL_P (2)
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_CLOCK_PLL_Q
|
|
|
|
#define CONFIG_CLOCK_PLL_Q (4)
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_CLOCK_PLL_R
|
|
|
|
#define CONFIG_CLOCK_PLL_R (4)
|
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name Clock bus settings (APB1 and APB2)
|
2021-09-05 20:39:15 +02:00
|
|
|
* @{
|
2020-09-03 22:26:48 +02:00
|
|
|
*/
|
|
|
|
#ifndef CONFIG_CLOCK_APB1_DIV
|
|
|
|
#define CONFIG_CLOCK_APB1_DIV (2) /* max 50MHz */
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_CLOCK_APB2_DIV
|
|
|
|
#define CONFIG_CLOCK_APB2_DIV (1) /* max 100MHz */
|
|
|
|
#endif
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#if CLOCK_CORECLOCK > MHZ(100)
|
|
|
|
#error "SYSCLK cannot exceed 100MHz"
|
|
|
|
#endif
|
|
|
|
|
2020-12-16 16:51:55 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-10-21 19:20:57 +02:00
|
|
|
#endif /* CLK_F2F4F7_CFG_CLOCK_DEFAULT_100_H */
|
2020-09-03 22:26:48 +02:00
|
|
|
/** @} */
|