Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 OTA keys S.A.
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
19#ifndef PERIPH_CONF_H
20#define PERIPH_CONF_H
21
22/* This board provides an LSE */
23#ifndef CONFIG_BOARD_HAS_LSE
24#define CONFIG_BOARD_HAS_LSE 1
25#endif
26
27/* This board provides an HSE */
28#ifndef CONFIG_BOARD_HAS_HSE
29#define CONFIG_BOARD_HAS_HSE 1
30#endif
31
32/* The HSE provides a 25MHz clock */
33#ifndef CONFIG_CLOCK_HSE
34#define CONFIG_CLOCK_HSE MHZ(25)
35#endif
36
37#include "periph_cpu.h"
38#include "clk_conf.h"
39#include "cfg_rtt_default.h"
40#include "cfg_timer_tim2.h"
41#include "cfg_usb_otg_fs.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
51static const uart_conf_t uart_config[] = {
52 {
53 .dev = USART1,
54 .rcc_mask = RCC_APB2ENR_USART1EN,
55 .rx_pin = GPIO_PIN(PORT_A, 10),
56 .tx_pin = GPIO_PIN(PORT_A, 9),
57 .rx_af = GPIO_AF7,
58 .tx_af = GPIO_AF7,
59 .bus = APB2,
60 .irqn = USART1_IRQn,
61 }
62};
63
64#define UART_0_ISR (isr_usart1)
65
66#define UART_NUMOF ARRAY_SIZE(uart_config)
76static const fmc_conf_t fmc_config = {
77 .bus = AHB3,
78 .rcc_mask = RCC_AHB3ENR_FMCEN,
79#if MODULE_PERIPH_FMC_SDRAM
80 .ba0_pin = { .pin = GPIO_PIN(PORT_G, 4), .af = GPIO_AF12, }, /* FMC_BA0 signal */
81 .ba1_pin = { .pin = GPIO_PIN(PORT_G, 5), .af = GPIO_AF12, }, /* FMC_BA1 signal */
82 .sdclk_pin = { .pin = GPIO_PIN(PORT_G, 8), .af = GPIO_AF12, }, /* FMC_SDCLK signal */
83 .sdnwe_pin = { .pin = GPIO_PIN(PORT_H, 5), .af = GPIO_AF12, }, /* FMC_SDNWE signal */
84 .sdnras_pin = { .pin = GPIO_PIN(PORT_F, 11), .af = GPIO_AF12, }, /* FMC_SDNRAS signal */
85 .sdncas_pin = { .pin = GPIO_PIN(PORT_G, 15), .af = GPIO_AF12, }, /* FMC_SDNCAS signal */
86 .sdcke0_pin = { .pin = GPIO_PIN(PORT_H, 2), .af = GPIO_AF12, }, /* FMC_SDCKE0 signal */
87 .sdne0_pin = { .pin = GPIO_PIN(PORT_H, 3), .af = GPIO_AF12, }, /* FMC_SDNE0 signal */
88 .addr = {
89 { .pin = GPIO_PIN(PORT_F, 0), .af = GPIO_AF12, }, /* FMC_A0 signal */
90 { .pin = GPIO_PIN(PORT_F, 1), .af = GPIO_AF12, }, /* FMC_A1 signal */
91 { .pin = GPIO_PIN(PORT_F, 2), .af = GPIO_AF12, }, /* FMC_A2 signal */
92 { .pin = GPIO_PIN(PORT_F, 3), .af = GPIO_AF12, }, /* FMC_A3 signal */
93 { .pin = GPIO_PIN(PORT_F, 4), .af = GPIO_AF12, }, /* FMC_A4 signal */
94 { .pin = GPIO_PIN(PORT_F, 5), .af = GPIO_AF12, }, /* FMC_A5 signal */
95 { .pin = GPIO_PIN(PORT_F, 12), .af = GPIO_AF12, }, /* FMC_A6 signal */
96 { .pin = GPIO_PIN(PORT_F, 13), .af = GPIO_AF12, }, /* FMC_A7 signal */
97 { .pin = GPIO_PIN(PORT_F, 14), .af = GPIO_AF12, }, /* FMC_A8 signal */
98 { .pin = GPIO_PIN(PORT_F, 15), .af = GPIO_AF12, }, /* FMC_A9 signal */
99 { .pin = GPIO_PIN(PORT_G, 0), .af = GPIO_AF12, }, /* FMC_A10 signal */
100 { .pin = GPIO_PIN(PORT_G, 1), .af = GPIO_AF12, }, /* FMC_A11 signal */
101 },
102#endif
103 .data = {
104 { .pin = GPIO_PIN(PORT_D, 14), .af = GPIO_AF12, }, /* FMC_D0 signal */
105 { .pin = GPIO_PIN(PORT_D, 15), .af = GPIO_AF12, }, /* FMC_D1 signal */
106 { .pin = GPIO_PIN(PORT_D, 0), .af = GPIO_AF12, }, /* FMC_D2 signal */
107 { .pin = GPIO_PIN(PORT_D, 1), .af = GPIO_AF12, }, /* FMC_D3 signal */
108 { .pin = GPIO_PIN(PORT_E, 7), .af = GPIO_AF12, }, /* FMC_D4 signal */
109 { .pin = GPIO_PIN(PORT_E, 8), .af = GPIO_AF12, }, /* FMC_D5 signal */
110 { .pin = GPIO_PIN(PORT_E, 9), .af = GPIO_AF12, }, /* FMC_D6 signal */
111 { .pin = GPIO_PIN(PORT_E, 10), .af = GPIO_AF12, }, /* FMC_D7 signal */
112#if MODULE_PERIPH_FMC_32BIT
113 { .pin = GPIO_PIN(PORT_E, 11), .af = GPIO_AF12, }, /* FMC_D8 signal */
114 { .pin = GPIO_PIN(PORT_E, 12), .af = GPIO_AF12, }, /* FMC_D9 signal */
115 { .pin = GPIO_PIN(PORT_E, 13), .af = GPIO_AF12, }, /* FMC_D10 signal */
116 { .pin = GPIO_PIN(PORT_E, 14), .af = GPIO_AF12, }, /* FMC_D11 signal */
117 { .pin = GPIO_PIN(PORT_E, 15), .af = GPIO_AF12, }, /* FMC_D12 signal */
118 { .pin = GPIO_PIN(PORT_D, 8), .af = GPIO_AF12, }, /* FMC_D13 signal */
119 { .pin = GPIO_PIN(PORT_D, 9), .af = GPIO_AF12, }, /* FMC_D14 signal */
120 { .pin = GPIO_PIN(PORT_D, 10), .af = GPIO_AF12, }, /* FMC_D15 signal */
121 { .pin = GPIO_PIN(PORT_H, 8), .af = GPIO_AF12, }, /* FMC_D16 signal */
122 { .pin = GPIO_PIN(PORT_H, 9), .af = GPIO_AF12, }, /* FMC_D17 signal */
123 { .pin = GPIO_PIN(PORT_H, 10), .af = GPIO_AF12, }, /* FMC_D18 signal */
124 { .pin = GPIO_PIN(PORT_H, 11), .af = GPIO_AF12, }, /* FMC_D19 signal */
125 { .pin = GPIO_PIN(PORT_H, 12), .af = GPIO_AF12, }, /* FMC_D20 signal */
126 { .pin = GPIO_PIN(PORT_H, 13), .af = GPIO_AF12, }, /* FMC_D21 signal */
127 { .pin = GPIO_PIN(PORT_H, 14), .af = GPIO_AF12, }, /* FMC_D22 signal */
128 { .pin = GPIO_PIN(PORT_H, 15), .af = GPIO_AF12, }, /* FMC_D23 signal */
129 { .pin = GPIO_PIN(PORT_I, 0), .af = GPIO_AF12, }, /* FMC_D24 signal */
130 { .pin = GPIO_PIN(PORT_I, 1), .af = GPIO_AF12, }, /* FMC_D25 signal */
131 { .pin = GPIO_PIN(PORT_I, 2), .af = GPIO_AF12, }, /* FMC_D26 signal */
132 { .pin = GPIO_PIN(PORT_I, 3), .af = GPIO_AF12, }, /* FMC_D27 signal */
133 { .pin = GPIO_PIN(PORT_I, 6), .af = GPIO_AF12, }, /* FMC_D28 signal */
134 { .pin = GPIO_PIN(PORT_I, 7), .af = GPIO_AF12, }, /* FMC_D29 signal */
135 { .pin = GPIO_PIN(PORT_I, 9), .af = GPIO_AF12, }, /* FMC_D30 signal */
136 { .pin = GPIO_PIN(PORT_I, 10), .af = GPIO_AF12, }, /* FMC_D31 signal */
137#endif
138 },
139 .nbl0_pin = { .pin = GPIO_PIN(PORT_E, 0), .af = GPIO_AF12, }, /* FMC_NBL0 signal (DQM0) */
140 .nbl1_pin = { .pin = GPIO_PIN(PORT_E, 1), .af = GPIO_AF12, }, /* FMC_NBL1 signal (DQM1) */
141 .nbl2_pin = { .pin = GPIO_PIN(PORT_I, 4), .af = GPIO_AF12, }, /* FMC_NBL2 signal (DQM2) */
142 .nbl3_pin = { .pin = GPIO_PIN(PORT_I, 5), .af = GPIO_AF12, }, /* FMC_NBL3 signal (DQM3) */
143};
144
153 /* bank 5 is used for SDRAM */
154 {
155 .bank = FMC_BANK_5,
156 .mem_type = FMC_SDRAM,
157 .data_width = FMC_BUS_WIDTH_32BIT,
158 .address = 0xc0000000, /* Bank 6 is mapped to 0xc0000000 */
159 .size = MiB(16), /* Size in MByte, 4M x 32 Bit */
160 .sdram = {
161 .clk_period = 2, /* SDCLK = 2 x HCLK */
162 .row_bits = 12, /* A11..A0 used for row address */
163 .col_bits = 8, /* A7..A0 used for column address */
164 .cas_latency = 2, /* CAS latency is 2 clock cycles */
165 .read_delay = 0, /* No read delay after CAS */
166 .burst_read = true, /* Burst read mode enabled */
167 .burst_write = false, /* Burst write mode disabled */
168 .burst_len = FMC_BURST_LENGTH_1, /* Burst length is 1 */
169 .burst_interleaved = false, /* Burst mode interleaved */
170 .write_protect = false, /* No write protection */
171 .four_banks = true, /* SDRAM has four internal banks */
172 .timing = { /* SDRAM Timing parameters */
173 .row_to_col_delay = 2, /* Row to column delay (2 clock cycles) */
174 .row_precharge = 2, /* Row precharge delay (2 clock cycles) */
175 .recovery_delay = 2, /* Recovery delay is (2 clock cycles) */
176 .row_cylce = 7, /* Row cycle delay is (7 clock cycles) */
177 .self_refresh = 4, /* Self refresh time is (4 clock cycles) */
178 .exit_self_refresh = 7, /* Exit self-refresh delay (7 clock cycles) */
179 .load_mode_register = 2, /* Load Mode Register to Activate delay */
180 .refresh_period = 64, /* Refresh period in ms */
181 },
182 },
183 },
184};
185
189#define FMC_BANK_NUMOF ARRAY_SIZE(fmc_bank_config)
192#ifdef __cplusplus
193}
194#endif
195
196#endif /* PERIPH_CONF_H */
@ PORT_G
port G
Definition periph_cpu.h:53
@ PORT_F
port F
Definition periph_cpu.h:52
@ PORT_E
port E
Definition periph_cpu.h:51
@ PORT_A
port A
Definition periph_cpu.h:47
@ PORT_D
port D
Definition periph_cpu.h:50
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
@ PORT_H
port H
Definition periph_cpu.h:52
static const fmc_bank_conf_t fmc_bank_config[]
FMC Bank configuration.
static const fmc_conf_t fmc_config
FMC controller configuration.
Common configuration for STM32 Timer peripheral based on TIM2.
Common configuration for STM32 OTG FS peripheral.
@ GPIO_AF12
use alternate function 12
Definition cpu_gpio.h:115
@ GPIO_AF7
use alternate function 7
Definition cpu_gpio.h:109
@ APB2
Advanced Peripheral Bus 2
Definition periph_cpu.h:80
@ FMC_SDRAM
SDRAM Controller used.
Definition cpu_fmc.h:345
@ FMC_BUS_WIDTH_32BIT
32 bit data bus width
Definition cpu_fmc.h:354
Bank configuration structure.
Definition cpu_fmc.h:360
fmc_bank_t bank
Bank1 .
Definition cpu_fmc.h:361
FMC peripheral configuration.
Definition cpu_fmc.h:278
uint8_t bus
AHB/APB bus.
Definition cpu_fmc.h:279
UART device configuration.
Definition periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition periph_cpu.h:219
#define MiB(x)
A macro to return the bytes in x MiB.
Definition units.h:34