Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Inria
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
9#pragma once
10
20
21/* This board provides an LSE */
22#ifndef CONFIG_BOARD_HAS_LSE
23#define CONFIG_BOARD_HAS_LSE 1
24#endif
25
26/* This board provides an HSE */
27#ifndef CONFIG_BOARD_HAS_HSE
28#define CONFIG_BOARD_HAS_HSE 1
29#endif
30
31#include "periph_cpu.h"
32#include "clk_conf.h"
33#include "cfg_timer_tim5.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
44static const dma_conf_t dma_config[] = {
45 { .stream = 14 }, /* DMA2 Stream 6 - SPI5_TX */
46 { .stream = 13 }, /* DMA2 Stream 5 - SPI5_RX */
47};
48
49#define DMA_0_ISR isr_dma2_stream6
50#define DMA_1_ISR isr_dma2_stream5
51
52#define DMA_NUMOF ARRAY_SIZE(dma_config)
54
59static const uart_conf_t uart_config[] = {
60 {
61 .dev = USART1,
62 .rcc_mask = RCC_APB2ENR_USART1EN,
63 .rx_pin = GPIO_PIN(PORT_A, 10),
64 .tx_pin = GPIO_PIN(PORT_A, 9),
65 .rx_af = GPIO_AF7,
66 .tx_af = GPIO_AF7,
67 .bus = APB2,
68 .irqn = USART1_IRQn,
69#ifdef MODULE_PERIPH_DMA
70 .dma = DMA_STREAM_UNDEF,
71 .dma_chan = UINT8_MAX,
72#endif
73 }
74};
75
76#define UART_0_ISR (isr_usart1)
77
78#define UART_NUMOF ARRAY_SIZE(uart_config)
80
85static const spi_conf_t spi_config[] = {
86 {
87 .dev = SPI5,
88 .mosi_pin = GPIO_PIN(PORT_F, 9),
89 .miso_pin = GPIO_PIN(PORT_F, 8),
90 .sclk_pin = GPIO_PIN(PORT_F, 7),
91 .cs_pin = GPIO_UNDEF,
92 .mosi_af = GPIO_AF5,
93 .miso_af = GPIO_AF5,
94 .sclk_af = GPIO_AF5,
95 .cs_af = GPIO_AF5,
96 .rccmask = RCC_APB2ENR_SPI5EN,
97 .apbbus = APB2,
98#ifdef MODULE_PERIPH_DMA
99 .tx_dma = 0,
100 .tx_dma_chan = 7,
101 .rx_dma = 1,
102 .rx_dma_chan = 7,
103#endif
104 }
105};
106
107#define SPI_NUMOF ARRAY_SIZE(spi_config)
109
114static const i2c_conf_t i2c_config[] = {
115 {
116 .dev = I2C3,
117 .speed = I2C_SPEED_NORMAL,
118 .scl_pin = GPIO_PIN(PORT_A, 8),
119 .sda_pin = GPIO_PIN(PORT_C, 9),
120 .scl_af = GPIO_AF4,
121 .sda_af = GPIO_AF4,
122 .bus = APB1,
123 .rcc_mask = RCC_APB1ENR_I2C3EN,
124 .clk = CLOCK_APB1,
125 .irqn = I2C3_EV_IRQn,
126 }
127};
128
129#define I2C_0_ISR isr_i2c3_ev
130
131#define I2C_NUMOF ARRAY_SIZE(i2c_config)
133
141static const fmc_conf_t fmc_config = {
142 .bus = AHB3,
143 .rcc_mask = RCC_AHB3ENR_FMCEN,
144#if MODULE_PERIPH_FMC_SDRAM
145 .ba0_pin = { .pin = GPIO_PIN(PORT_G, 4), .af = GPIO_AF12, }, /* FMC_BA0 signal */
146 .ba1_pin = { .pin = GPIO_PIN(PORT_G, 5), .af = GPIO_AF12, }, /* FMC_BA1 signal */
147 .sdclk_pin = { .pin = GPIO_PIN(PORT_G, 8), .af = GPIO_AF12, }, /* FMC_SDCLK signal */
148 .sdnwe_pin = { .pin = GPIO_PIN(PORT_C, 0), .af = GPIO_AF12, }, /* FMC_SDNWE signal */
149 .sdnras_pin = { .pin = GPIO_PIN(PORT_F, 11), .af = GPIO_AF12, }, /* FMC_SDNRAS signal */
150 .sdncas_pin = { .pin = GPIO_PIN(PORT_G, 15), .af = GPIO_AF12, }, /* FMC_SDNCAS signal */
151 .sdcke1_pin = { .pin = GPIO_PIN(PORT_B, 5), .af = GPIO_AF12, }, /* FMC_SDCKE1 signal */
152 .sdne1_pin = { .pin = GPIO_PIN(PORT_B, 6), .af = GPIO_AF12, }, /* FMC_SDNE1 signal */
153 .addr = {
154 { .pin = GPIO_PIN(PORT_F, 0), .af = GPIO_AF12, }, /* FMC_A0 signal */
155 { .pin = GPIO_PIN(PORT_F, 1), .af = GPIO_AF12, }, /* FMC_A1 signal */
156 { .pin = GPIO_PIN(PORT_F, 2), .af = GPIO_AF12, }, /* FMC_A2 signal */
157 { .pin = GPIO_PIN(PORT_F, 3), .af = GPIO_AF12, }, /* FMC_A3 signal */
158 { .pin = GPIO_PIN(PORT_F, 4), .af = GPIO_AF12, }, /* FMC_A4 signal */
159 { .pin = GPIO_PIN(PORT_F, 5), .af = GPIO_AF12, }, /* FMC_A5 signal */
160 { .pin = GPIO_PIN(PORT_F, 12), .af = GPIO_AF12, }, /* FMC_A6 signal */
161 { .pin = GPIO_PIN(PORT_F, 13), .af = GPIO_AF12, }, /* FMC_A7 signal */
162 { .pin = GPIO_PIN(PORT_F, 14), .af = GPIO_AF12, }, /* FMC_A8 signal */
163 { .pin = GPIO_PIN(PORT_F, 15), .af = GPIO_AF12, }, /* FMC_A9 signal */
164 { .pin = GPIO_PIN(PORT_G, 0), .af = GPIO_AF12, }, /* FMC_A10 signal */
165 { .pin = GPIO_PIN(PORT_G, 1), .af = GPIO_AF12, }, /* FMC_A11 signal */
166 },
167#endif
168 .data = {
169 { .pin = GPIO_PIN(PORT_D, 14), .af = GPIO_AF12, }, /* FMC_D0 signal */
170 { .pin = GPIO_PIN(PORT_D, 15), .af = GPIO_AF12, }, /* FMC_D1 signal */
171 { .pin = GPIO_PIN(PORT_D, 0), .af = GPIO_AF12, }, /* FMC_D2 signal */
172 { .pin = GPIO_PIN(PORT_D, 1), .af = GPIO_AF12, }, /* FMC_D3 signal */
173 { .pin = GPIO_PIN(PORT_E, 7), .af = GPIO_AF12, }, /* FMC_D4 signal */
174 { .pin = GPIO_PIN(PORT_E, 8), .af = GPIO_AF12, }, /* FMC_D5 signal */
175 { .pin = GPIO_PIN(PORT_E, 9), .af = GPIO_AF12, }, /* FMC_D6 signal */
176 { .pin = GPIO_PIN(PORT_E, 10), .af = GPIO_AF12, }, /* FMC_D7 signal */
177#if MODULE_PERIPH_FMC_16BIT
178 { .pin = GPIO_PIN(PORT_E, 11), .af = GPIO_AF12, }, /* FMC_D8 signal */
179 { .pin = GPIO_PIN(PORT_E, 12), .af = GPIO_AF12, }, /* FMC_D9 signal */
180 { .pin = GPIO_PIN(PORT_E, 13), .af = GPIO_AF12, }, /* FMC_D10 signal */
181 { .pin = GPIO_PIN(PORT_E, 14), .af = GPIO_AF12, }, /* FMC_D11 signal */
182 { .pin = GPIO_PIN(PORT_E, 15), .af = GPIO_AF12, }, /* FMC_D12 signal */
183 { .pin = GPIO_PIN(PORT_D, 8), .af = GPIO_AF12, }, /* FMC_D13 signal */
184 { .pin = GPIO_PIN(PORT_D, 9), .af = GPIO_AF12, }, /* FMC_D14 signal */
185 { .pin = GPIO_PIN(PORT_D, 10), .af = GPIO_AF12, }, /* FMC_D15 signal */
186#endif
187 },
188 .nbl0_pin = { .pin = GPIO_PIN(PORT_E, 0), .af = GPIO_AF12, }, /* FMC_NBL0 signal (LB) */
189 .nbl1_pin = { .pin = GPIO_PIN(PORT_E, 1), .af = GPIO_AF12, }, /* FMC_NBL1 signal (UB) */
190};
191
200 /* bank 6 is used for SDRAM */
201 {
202 .bank = FMC_BANK_6,
203 .mem_type = FMC_SDRAM,
204 .data_width = FMC_BUS_WIDTH_16BIT,
205 .address = 0xd0000000, /* Bank 6 is mapped to 0xd0000000 */
206 .size = MiB(8), /* Size in Mbyte, 4M x 16 bit */
207 .sdram = {
208 .clk_period = 2, /* SDCLK = 2 x HCLK */
209 .row_bits = 12, /* A11..A0 used for row address */
210 .col_bits = 8, /* A8..A0 used for column address */
211 .cas_latency = 3, /* CAS latency is 3 clock cycles */
212 .read_delay = 0, /* No read delay after CAS */
213 .burst_read = false, /* Burst read mode disabled */
214 .burst_write = false, /* Burst write mode disabled */
215 .burst_len = FMC_BURST_LENGTH_1, /* Burst length is 1 if enabled */
216 .burst_interleaved = false, /* Burst mode interleaved */
217 .write_protect = false, /* No write protection */
218 .four_banks = true, /* SDRAM has four internal banks */
219 .timing = { /* SDRAM Timing parameters */
220 .row_to_col_delay = 2, /* Row to column delay (2 clock cycles) */
221 .row_precharge = 2, /* Row precharge delay (2 clock cycles) */
222 .recovery_delay = 2, /* Recovery delay is (2 clock cycles) */
223 .row_cylce = 7, /* Row cycle delay is (7 clock cycles) */
224 .self_refresh = 4, /* Self refresh time is (4 clock cycles) */
225 .exit_self_refresh = 7, /* Exit self-refresh delay (7 clock cycles) */
226 .load_mode_register = 2, /* Load Mode Register to Activate delay */
227 .refresh_period = 64, /* Refresh period in ms */
228 },
229 },
230 },
231};
232
236#define FMC_BANK_NUMOF ARRAY_SIZE(fmc_bank_config)
238
239#ifdef __cplusplus
240}
241#endif
242
@ PORT_B
port B
Definition periph_cpu.h:47
@ PORT_G
port G
Definition periph_cpu.h:52
@ PORT_C
port C
Definition periph_cpu.h:48
@ PORT_F
port F
Definition periph_cpu.h:51
@ PORT_E
port E
Definition periph_cpu.h:50
@ PORT_A
port A
Definition periph_cpu.h:46
@ PORT_D
port D
Definition periph_cpu.h:49
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:45
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
@ I2C_SPEED_NORMAL
normal mode: ~100 kbit/s
Definition periph_cpu.h:277
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 TIM5.
Common configuration for STM32 OTG HS peripheral with on-chip FS PHY.
@ GPIO_AF5
use alternate function 5
Definition cpu_gpio.h:106
@ GPIO_AF4
use alternate function 4
Definition cpu_gpio.h:105
@ GPIO_AF12
use alternate function 12
Definition cpu_gpio.h:114
@ GPIO_AF7
use alternate function 7
Definition cpu_gpio.h:108
@ APB1
Advanced Peripheral Bus 1.
Definition periph_cpu.h:78
@ APB2
Advanced Peripheral Bus 2.
Definition periph_cpu.h:79
@ FMC_SDRAM
SDRAM Controller used.
Definition cpu_fmc.h:344
@ FMC_BUS_WIDTH_16BIT
16 bit data bus width
Definition cpu_fmc.h:352
DMA configuration.
Definition cpu_dma.h:31
Bank configuration structure.
Definition cpu_fmc.h:359
FMC peripheral configuration.
Definition cpu_fmc.h:277
I2C configuration structure.
Definition periph_cpu.h:298
SPI device configuration.
Definition periph_cpu.h:336
UART device configuration.
Definition periph_cpu.h:217
#define MiB(x)
A macro to return the bytes in x MiB.
Definition units.h:33