2014-04-17 19:35:40 +02:00
|
|
|
/*
|
2015-10-27 13:34:40 +01:00
|
|
|
* Copyright (C) 2014-2015 Freie Universität Berlin
|
2014-04-17 19:35:40 +02:00
|
|
|
*
|
2014-08-23 15:43:13 +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.
|
2014-04-17 19:35:40 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-02-12 13:33:59 +01:00
|
|
|
* @ingroup boards_arduino-due
|
2014-04-17 19:35:40 +02:00
|
|
|
* @{
|
|
|
|
*
|
2014-10-21 16:52:30 +02:00
|
|
|
* @file
|
2014-04-17 19:35:40 +02:00
|
|
|
* @brief Peripheral MCU configuration for the Arduino Due board
|
|
|
|
*
|
2014-10-08 09:20:52 +02:00
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
|
|
* @author Peter Kietzmann <peter.kietzmann@haw-hamburg.de>
|
2015-06-01 16:07:00 +02:00
|
|
|
* @author Andreas "Paul" Pauli <andreas.pauli@haw-hamburg.de>
|
2014-04-17 19:35:40 +02:00
|
|
|
*/
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#ifndef PERIPH_CONF_H
|
|
|
|
#define PERIPH_CONF_H
|
2014-04-17 19:35:40 +02:00
|
|
|
|
2015-10-27 13:34:40 +01:00
|
|
|
#include "periph_cpu.h"
|
|
|
|
|
2014-10-13 15:25:50 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-01-05 13:32:33 +01:00
|
|
|
/**
|
2017-06-27 10:59:17 +02:00
|
|
|
* @name Clock configuration
|
2016-01-05 13:32:33 +01:00
|
|
|
* @{
|
|
|
|
*/
|
2016-03-01 15:56:45 +01:00
|
|
|
/* targeted system core clock */
|
|
|
|
#define CLOCK_CORECLOCK (84000000UL)
|
|
|
|
/* external oscillator clock */
|
|
|
|
#define CLOCK_EXT_OSC (12000000UL)
|
|
|
|
/* define PLL configuration
|
|
|
|
*
|
|
|
|
* The values must fulfill this equation:
|
|
|
|
* CORECLOCK = (EXT_OCS / PLL_DIV) * (PLL_MUL + 1)
|
|
|
|
*/
|
|
|
|
#define CLOCK_PLL_MUL (83)
|
|
|
|
#define CLOCK_PLL_DIV (12)
|
|
|
|
|
|
|
|
/* number of wait states before flash read and write operations */
|
|
|
|
#define CLOCK_FWS (4) /* 4 is save for 84MHz */
|
2016-01-05 13:32:33 +01:00
|
|
|
/** @} */
|
|
|
|
|
2014-04-17 19:35:40 +02:00
|
|
|
/**
|
2017-06-27 10:59:17 +02:00
|
|
|
* @name Timer peripheral configuration
|
2014-04-17 19:35:40 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2016-02-24 18:36:52 +01:00
|
|
|
static const timer_conf_t timer_config[] = {
|
2017-06-27 10:59:17 +02:00
|
|
|
{ .dev = TC0, .id_ch0 = ID_TC0 },
|
|
|
|
{ .dev = TC1, .id_ch0 = ID_TC3 }
|
2016-02-24 18:36:52 +01:00
|
|
|
};
|
2014-04-17 19:35:40 +02:00
|
|
|
|
2016-02-24 18:36:52 +01:00
|
|
|
#define TIMER_0_ISR isr_tc0
|
|
|
|
#define TIMER_1_ISR isr_tc3
|
2014-04-17 19:35:40 +02:00
|
|
|
|
2016-02-24 18:36:52 +01:00
|
|
|
#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
|
2014-04-17 19:35:40 +02:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
2017-06-27 10:59:17 +02:00
|
|
|
* @name UART configuration
|
2014-04-17 19:35:40 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2015-10-27 13:34:40 +01:00
|
|
|
static const uart_conf_t uart_config[] = {
|
2017-06-27 10:59:17 +02:00
|
|
|
{
|
|
|
|
.dev = (Uart *)UART,
|
|
|
|
.rx_port = PIOA,
|
|
|
|
.tx_port = PIOA,
|
|
|
|
.rx_pin = 8,
|
|
|
|
.tx_pin = 9,
|
|
|
|
.mux = GPIO_MUX_A,
|
|
|
|
.pmc_id = ID_UART,
|
|
|
|
.irqn = UART_IRQn
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.dev = (Uart *)USART0,
|
|
|
|
.rx_port = PIOA,
|
|
|
|
.tx_port = PIOA,
|
|
|
|
.rx_pin = 10,
|
|
|
|
.tx_pin = 11,
|
|
|
|
.mux = GPIO_MUX_A,
|
|
|
|
.pmc_id = ID_USART0,
|
|
|
|
.irqn = USART0_IRQn
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.dev = (Uart *)USART1,
|
|
|
|
.rx_port = PIOA,
|
|
|
|
.tx_port = PIOA,
|
|
|
|
.rx_pin = 12,
|
|
|
|
.tx_pin = 13,
|
|
|
|
.mux = GPIO_MUX_A,
|
|
|
|
.pmc_id = ID_USART1,
|
|
|
|
.irqn = USART1_IRQn
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.dev = (Uart *)USART3,
|
|
|
|
.rx_port = PIOD,
|
|
|
|
.tx_port = PIOD,
|
|
|
|
.rx_pin = 4,
|
|
|
|
.tx_pin = 5,
|
|
|
|
.mux = GPIO_MUX_B,
|
|
|
|
.pmc_id = ID_USART3,
|
|
|
|
.irqn = USART3_IRQn
|
|
|
|
},
|
2015-10-27 13:34:40 +01:00
|
|
|
};
|
2014-04-17 19:35:40 +02:00
|
|
|
|
2015-10-27 13:34:40 +01:00
|
|
|
/* define interrupt vectors */
|
2014-04-17 19:35:40 +02:00
|
|
|
#define UART_0_ISR isr_uart
|
2014-10-17 00:34:11 +02:00
|
|
|
#define UART_1_ISR isr_usart0
|
|
|
|
#define UART_2_ISR isr_usart1
|
|
|
|
#define UART_3_ISR isr_usart3
|
2015-10-27 13:34:40 +01:00
|
|
|
|
|
|
|
#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
|
2014-04-17 19:35:40 +02:00
|
|
|
/** @} */
|
|
|
|
|
2014-10-08 09:20:52 +02:00
|
|
|
/**
|
2017-06-27 10:59:17 +02:00
|
|
|
* @name SPI configuration
|
2014-10-08 09:20:52 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2016-11-08 18:27:41 +01:00
|
|
|
static const spi_conf_t spi_config[] = {
|
|
|
|
{
|
|
|
|
.dev = SPI0,
|
|
|
|
.id = ID_SPI0,
|
|
|
|
.clk = GPIO_PIN(PA, 27),
|
|
|
|
.mosi = GPIO_PIN(PA, 26),
|
|
|
|
.miso = GPIO_PIN(PA, 25),
|
|
|
|
.mux = GPIO_MUX_A
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
|
2014-10-08 09:20:52 +02:00
|
|
|
/** @} */
|
|
|
|
|
2015-06-01 16:07:00 +02:00
|
|
|
/**
|
2017-02-16 17:59:21 +01:00
|
|
|
* @name PWM configuration
|
2015-06-01 16:07:00 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2016-12-13 15:51:47 +01:00
|
|
|
static const pwm_chan_conf_t pwm_chan[] = {
|
2017-06-27 10:59:17 +02:00
|
|
|
{ .pin = GPIO_PIN(PC, 21), .hwchan = 4 },
|
|
|
|
{ .pin = GPIO_PIN(PC, 22), .hwchan = 5 },
|
|
|
|
{ .pin = GPIO_PIN(PC, 23), .hwchan = 6 },
|
|
|
|
{ .pin = GPIO_PIN(PC, 24), .hwchan = 7 }
|
2016-12-13 15:51:47 +01:00
|
|
|
};
|
|
|
|
|
2015-06-01 16:07:00 +02:00
|
|
|
#define PWM_NUMOF (1U)
|
2016-12-13 15:51:47 +01:00
|
|
|
#define PWM_CHAN_NUMOF (sizeof(pwm_chan) / sizeof(pwm_chan[0]))
|
2015-06-01 16:07:00 +02:00
|
|
|
/** @} */
|
|
|
|
|
2014-10-13 15:25:50 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#endif /* PERIPH_CONF_H */
|
2014-06-21 16:32:57 +02:00
|
|
|
/** @} */
|