2014-08-25 13:45:22 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-02-12 13:37:39 +01:00
|
|
|
* @ingroup boards_fox
|
2014-08-25 13:45:22 +02:00
|
|
|
* @{
|
|
|
|
*
|
2014-11-28 14:20:24 +01:00
|
|
|
* @file
|
2014-08-25 13:45:22 +02:00
|
|
|
* @brief Peripheral MCU configuration for the fox board
|
|
|
|
*
|
|
|
|
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de>
|
|
|
|
*/
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#ifndef PERIPH_CONF_H
|
|
|
|
#define PERIPH_CONF_H
|
2014-08-25 13:45:22 +02:00
|
|
|
|
2016-03-01 14:09:52 +01:00
|
|
|
#include "periph_cpu.h"
|
|
|
|
|
2014-08-25 13:45:22 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2018-01-23 11:49:42 +01:00
|
|
|
* @name Clock settings
|
|
|
|
*
|
|
|
|
* @note This is auto-generated from
|
|
|
|
* `cpu/stm32_common/dist/clk_conf/clk_conf.c`
|
2014-08-25 13:45:22 +02:00
|
|
|
* @{
|
2017-04-26 13:03:12 +02:00
|
|
|
*/
|
2018-01-23 11:49:42 +01:00
|
|
|
/* give the target core clock (HCLK) frequency [in Hz],
|
|
|
|
* maximum: 72MHz */
|
|
|
|
#define CLOCK_CORECLOCK (72000000U)
|
|
|
|
/* 0: no external high speed crystal available
|
|
|
|
* else: actual crystal frequency [in Hz] */
|
|
|
|
#define CLOCK_HSE (16000000U)
|
|
|
|
/* 0: no external low speed crystal available,
|
|
|
|
* 1: external crystal available (always 32.768kHz) */
|
|
|
|
#define CLOCK_LSE (1U)
|
|
|
|
/* peripheral clock setup */
|
2017-04-26 13:03:12 +02:00
|
|
|
#define CLOCK_AHB_DIV RCC_CFGR_HPRE_DIV1
|
|
|
|
#define CLOCK_AHB (CLOCK_CORECLOCK / 1)
|
2018-01-23 11:49:42 +01:00
|
|
|
#define CLOCK_APB1_DIV RCC_CFGR_PPRE1_DIV2 /* max 36MHz */
|
2016-03-16 10:32:35 +01:00
|
|
|
#define CLOCK_APB1 (CLOCK_CORECLOCK / 2)
|
2018-01-23 11:49:42 +01:00
|
|
|
#define CLOCK_APB2_DIV RCC_CFGR_PPRE2_DIV1 /* max 72MHz */
|
|
|
|
#define CLOCK_APB2 (CLOCK_CORECLOCK / 1)
|
|
|
|
|
|
|
|
/* PLL factors */
|
|
|
|
#define CLOCK_PLL_PREDIV (2)
|
|
|
|
#define CLOCK_PLL_MUL (9)
|
2014-08-25 13:45:22 +02:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
2017-04-10 19:04:32 +02:00
|
|
|
* @name Timer configuration
|
2014-08-25 13:45:22 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2016-03-01 14:09:52 +01:00
|
|
|
static const timer_conf_t timer_config[] = {
|
2016-03-16 10:53:36 +01:00
|
|
|
{
|
2016-03-16 12:19:33 +01:00
|
|
|
.dev = TIM2,
|
2016-12-07 12:56:24 +01:00
|
|
|
.max = 0x0000ffff,
|
2016-03-16 12:19:33 +01:00
|
|
|
.rcc_mask = RCC_APB1ENR_TIM2EN,
|
|
|
|
.bus = APB1,
|
|
|
|
.irqn = TIM2_IRQn
|
2016-03-16 10:53:36 +01:00
|
|
|
},
|
|
|
|
{
|
2016-03-16 12:19:33 +01:00
|
|
|
.dev = TIM3,
|
2016-12-07 12:56:24 +01:00
|
|
|
.max = 0x0000ffff,
|
2016-03-16 12:19:33 +01:00
|
|
|
.rcc_mask = RCC_APB1ENR_TIM3EN,
|
|
|
|
.bus = APB1,
|
|
|
|
.irqn = TIM3_IRQn
|
2016-03-16 10:53:36 +01:00
|
|
|
}
|
2016-03-01 14:09:52 +01:00
|
|
|
};
|
2014-08-25 13:45:22 +02:00
|
|
|
|
2016-03-01 14:09:52 +01:00
|
|
|
#define TIMER_0_ISR isr_tim2
|
|
|
|
#define TIMER_1_ISR isr_tim3
|
2014-08-25 13:45:22 +02:00
|
|
|
|
2019-07-18 15:14:29 +02:00
|
|
|
#define TIMER_NUMOF ARRAY_SIZE(timer_config)
|
2014-08-25 13:45:22 +02:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
2017-04-10 19:04:32 +02:00
|
|
|
* @name UART configuration
|
2015-07-31 20:07:34 +02:00
|
|
|
* @{
|
2014-08-25 13:45:22 +02:00
|
|
|
*/
|
2016-03-16 10:32:35 +01:00
|
|
|
static const uart_conf_t uart_config[] = {
|
|
|
|
{
|
2016-12-07 17:03:52 +01:00
|
|
|
.dev = USART2,
|
|
|
|
.rcc_mask = RCC_APB1ENR_USART2EN,
|
|
|
|
.rx_pin = GPIO_PIN(PORT_A, 3),
|
|
|
|
.tx_pin = GPIO_PIN(PORT_A, 2),
|
|
|
|
.bus = APB1,
|
|
|
|
.irqn = USART2_IRQn
|
2016-03-16 10:32:35 +01:00
|
|
|
},
|
|
|
|
{
|
2016-12-07 17:03:52 +01:00
|
|
|
.dev = USART1,
|
|
|
|
.rcc_mask = RCC_APB2ENR_USART1EN,
|
|
|
|
.rx_pin = GPIO_PIN(PORT_A, 10),
|
|
|
|
.tx_pin = GPIO_PIN(PORT_A, 9),
|
|
|
|
.bus = APB2,
|
|
|
|
.irqn = USART1_IRQn
|
2016-03-16 10:32:35 +01:00
|
|
|
}
|
|
|
|
};
|
2014-08-25 13:45:22 +02:00
|
|
|
|
2016-12-07 17:03:52 +01:00
|
|
|
#define UART_0_ISR (isr_usart2)
|
|
|
|
#define UART_1_ISR (isr_usart1)
|
2016-03-16 10:32:35 +01:00
|
|
|
|
2019-07-18 15:14:29 +02:00
|
|
|
#define UART_NUMOF ARRAY_SIZE(uart_config)
|
2015-07-31 20:07:34 +02:00
|
|
|
/** @} */
|
2014-08-25 13:45:22 +02:00
|
|
|
|
|
|
|
/**
|
2017-04-10 19:04:32 +02:00
|
|
|
* @name SPI configuration
|
2014-08-25 13:45:22 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2016-11-08 18:28:32 +01:00
|
|
|
static const spi_conf_t spi_config[] = {
|
|
|
|
{
|
|
|
|
.dev = SPI2,
|
|
|
|
.mosi_pin = GPIO_PIN(PORT_B, 15),
|
|
|
|
.miso_pin = GPIO_PIN(PORT_B, 14),
|
|
|
|
.sclk_pin = GPIO_PIN(PORT_B, 13),
|
|
|
|
.cs_pin = GPIO_UNDEF,
|
|
|
|
.rccmask = RCC_APB1ENR_SPI2EN,
|
|
|
|
.apbbus = APB1
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-07-18 15:14:29 +02:00
|
|
|
#define SPI_NUMOF ARRAY_SIZE(spi_config)
|
2014-08-25 13:45:22 +02:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
2017-04-10 19:04:32 +02:00
|
|
|
* @name Real time counter configuration
|
2014-08-25 13:45:22 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2020-04-15 11:49:24 +02:00
|
|
|
#ifndef RTT_FREQUENCY
|
2014-08-25 13:45:22 +02:00
|
|
|
#define RTT_FREQUENCY (1) /* in Hz */
|
2020-04-15 11:49:24 +02:00
|
|
|
#endif
|
2014-08-25 13:45:22 +02:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
2017-04-10 19:04:32 +02:00
|
|
|
* @name I2C configuration
|
2014-08-25 13:45:22 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2018-05-31 23:12:19 +02:00
|
|
|
static const i2c_conf_t i2c_config[] = {
|
|
|
|
{
|
|
|
|
.dev = I2C1,
|
|
|
|
.speed = I2C_SPEED_NORMAL,
|
|
|
|
.scl_pin = GPIO_PIN(PORT_B, 6),
|
|
|
|
.sda_pin = GPIO_PIN(PORT_B, 7),
|
|
|
|
.bus = APB1,
|
|
|
|
.rcc_mask = RCC_APB1ENR_I2C1EN,
|
|
|
|
.clk = CLOCK_APB1,
|
|
|
|
.irqn = I2C1_EV_IRQn
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define I2C_0_ISR isr_i2c1_ev
|
|
|
|
|
2019-07-18 15:14:29 +02:00
|
|
|
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
|
2014-08-25 13:45:22 +02:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#endif /* PERIPH_CONF_H */
|
2014-08-25 13:45:22 +02:00
|
|
|
/** @} */
|