2019-05-18 20:06:16 +02:00
|
|
|
/*
|
2020-08-28 13:59:07 +02:00
|
|
|
* Copyright (C) 2018-2020 Inria
|
2019-05-18 20:06:16 +02:00
|
|
|
*
|
|
|
|
* 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
|
2020-08-28 13:59:07 +02:00
|
|
|
* @brief Default STM32L0 clock configuration
|
2019-05-18 20:06:16 +02:00
|
|
|
*
|
|
|
|
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
|
|
|
*/
|
|
|
|
|
2020-08-28 13:59:07 +02:00
|
|
|
#ifndef L0_CFG_CLOCK_DEFAULT_H
|
|
|
|
#define L0_CFG_CLOCK_DEFAULT_H
|
2019-05-18 20:06:16 +02:00
|
|
|
|
|
|
|
#include "periph_cpu.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name Clock system configuration
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#define CLOCK_HSI (16000000U) /* internal oscillator */
|
|
|
|
#define CLOCK_CORECLOCK (32000000U) /* desired core clock frequency */
|
2020-08-28 13:59:07 +02:00
|
|
|
#ifndef CLOCK_LSE
|
2019-05-18 20:06:16 +02:00
|
|
|
#define CLOCK_LSE (1) /* enable low speed external oscillator */
|
2020-08-28 13:59:07 +02:00
|
|
|
#endif
|
2019-05-18 20:06:16 +02:00
|
|
|
|
|
|
|
/* configuration of PLL prescaler and multiply values */
|
|
|
|
/* CORECLOCK := HSI / CLOCK_PLL_DIV * CLOCK_PLL_MUL */
|
|
|
|
#define CLOCK_PLL_DIV RCC_CFGR_PLLDIV2
|
|
|
|
#define CLOCK_PLL_MUL RCC_CFGR_PLLMUL4
|
|
|
|
/* configuration of peripheral bus clock prescalers */
|
|
|
|
#define CLOCK_AHB_DIV RCC_CFGR_HPRE_DIV1 /* AHB clock -> 32MHz */
|
|
|
|
#define CLOCK_APB2_DIV RCC_CFGR_PPRE2_DIV1 /* APB2 clock -> 32MHz */
|
|
|
|
#define CLOCK_APB1_DIV RCC_CFGR_PPRE1_DIV1 /* APB1 clock -> 32MHz */
|
|
|
|
/* configuration of flash access cycles */
|
|
|
|
#define CLOCK_FLASH_LATENCY FLASH_ACR_LATENCY
|
|
|
|
|
|
|
|
/* bus clocks for simplified peripheral initialization, UPDATE MANUALLY! */
|
|
|
|
#define CLOCK_AHB (CLOCK_CORECLOCK / 1)
|
|
|
|
#define CLOCK_APB2 (CLOCK_CORECLOCK / 1)
|
|
|
|
#define CLOCK_APB1 (CLOCK_CORECLOCK / 1)
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-08-28 13:59:07 +02:00
|
|
|
#endif /* L0_CFG_CLOCK_DEFAULT_H */
|
2019-05-18 20:06:16 +02:00
|
|
|
/** @} */
|