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