Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016-2017 OTA keys S.A.
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
19
20/* This board provides an LSE */
21#ifndef CONFIG_BOARD_HAS_LSE
22#define CONFIG_BOARD_HAS_LSE 1
23#endif
24
25/* This board provides an HSE */
26#ifndef CONFIG_BOARD_HAS_HSE
27#define CONFIG_BOARD_HAS_HSE 1
28#endif
29
30#include "periph_cpu.h"
31#include "clk_conf.h"
32#include "cfg_i2c1_pb8_pb9.h"
33#include "cfg_usb_otg_fs.h"
34#include "mii.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
44static const dma_conf_t dma_config[] = {
45 { .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */
46 { .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */
47 { .stream = 3 }, /* DMA1 Stream 3 - SPI2_RX/USART3_TX */
48 { .stream = 4 }, /* DMA1 Stream 4 - SPI2_TX */
49 { .stream = 14 }, /* DMA2 Stream 6 - USART6_TX */
50 { .stream = 6 }, /* DMA1 Stream 6 - USART2_TX */
51 { .stream = 8 }, /* DMA2 Stream 0 - ETH_TX */
52};
53
54#define DMA_0_ISR isr_dma2_stream2
55#define DMA_1_ISR isr_dma2_stream3
56#define DMA_2_ISR isr_dma1_stream3
57#define DMA_3_ISR isr_dma1_stream4
58#define DMA_4_ISR isr_dma2_stream6
59#define DMA_5_ISR isr_dma1_stream6
60#define DMA_6_ISR isr_dma2_stream0
61
62#define DMA_NUMOF ARRAY_SIZE(dma_config)
64
69static const pwm_conf_t pwm_config[] = {
70 {
71 .dev = TIM1,
72 .rcc_mask = RCC_APB2ENR_TIM1EN,
73 .chan = { { .pin = GPIO_PIN(PORT_E, 9) /* D6 */, .cc_chan = 0},
74 { .pin = GPIO_PIN(PORT_E, 11) /* D5 */, .cc_chan = 1},
75 { .pin = GPIO_PIN(PORT_E, 13) /* D3 */, .cc_chan = 2},
76 { .pin = GPIO_UNDEF, .cc_chan = 0} },
77 .af = GPIO_AF1,
78 .bus = APB2
79 },
80 {
81 .dev = TIM4,
82 .rcc_mask = RCC_APB1ENR_TIM4EN,
83 .chan = { { .pin = GPIO_PIN(PORT_D, 15) /* D9 */, .cc_chan = 3},
84 { .pin = GPIO_UNDEF, .cc_chan = 0},
85 { .pin = GPIO_UNDEF, .cc_chan = 0},
86 { .pin = GPIO_UNDEF, .cc_chan = 0} },
87 .af = GPIO_AF2,
88 .bus = APB1
89 },
90};
91
92#define PWM_NUMOF ARRAY_SIZE(pwm_config)
94
99static const timer_conf_t timer_config[] = {
100 {
101 .dev = TIM2,
102 .max = 0xffffffff,
103 .rcc_mask = RCC_APB1ENR_TIM2EN,
104 .bus = APB1,
105 .irqn = TIM2_IRQn
106 },
107 {
108 .dev = TIM5,
109 .max = 0xffffffff,
110 .rcc_mask = RCC_APB1ENR_TIM5EN,
111 .bus = APB1,
112 .irqn = TIM5_IRQn
113 }
114};
115
116#define TIMER_0_ISR isr_tim2
117#define TIMER_1_ISR isr_tim5
118
119#define TIMER_NUMOF ARRAY_SIZE(timer_config)
121
126static const uart_conf_t uart_config[] = {
127 {
128 .dev = USART3,
129 .rcc_mask = RCC_APB1ENR_USART3EN,
130 .rx_pin = GPIO_PIN(PORT_D, 9),
131 .tx_pin = GPIO_PIN(PORT_D, 8),
132 .rx_af = GPIO_AF7,
133 .tx_af = GPIO_AF7,
134 .bus = APB1,
135 .irqn = USART3_IRQn,
136#ifdef MODULE_PERIPH_DMA
137 .dma = 2,
138 .dma_chan = 4
139#endif
140 },
141 {
142 .dev = USART6,
143 .rcc_mask = RCC_APB2ENR_USART6EN,
144 .rx_pin = GPIO_PIN(PORT_G, 9),
145 .tx_pin = GPIO_PIN(PORT_G, 14),
146 .rx_af = GPIO_AF8,
147 .tx_af = GPIO_AF8,
148 .bus = APB2,
149 .irqn = USART6_IRQn,
150#ifdef MODULE_PERIPH_DMA
151 .dma = 4,
152 .dma_chan = 5
153#endif
154 },
155 {
156 .dev = USART2,
157 .rcc_mask = RCC_APB1ENR_USART2EN,
158 .rx_pin = GPIO_PIN(PORT_D, 6),
159 .tx_pin = GPIO_PIN(PORT_D, 5),
160 .rx_af = GPIO_AF7,
161 .tx_af = GPIO_AF7,
162 .bus = APB1,
163 .irqn = USART2_IRQn,
164#ifdef MODULE_PERIPH_DMA
165 .dma = 5,
166 .dma_chan = 4
167#endif
168 },
169};
170
171#define UART_0_ISR (isr_usart3)
172#define UART_1_ISR (isr_usart6)
173#define UART_2_ISR (isr_usart2)
174
175#define UART_NUMOF ARRAY_SIZE(uart_config)
177
182static const spi_conf_t spi_config[] = {
183 {
184 .dev = SPI1,
185 .mosi_pin = GPIO_PIN(PORT_A, 7),
186 .miso_pin = GPIO_PIN(PORT_A, 6),
187 .sclk_pin = GPIO_PIN(PORT_A, 5),
188 .cs_pin = GPIO_PIN(PORT_A, 4),
189 .mosi_af = GPIO_AF5,
190 .miso_af = GPIO_AF5,
191 .sclk_af = GPIO_AF5,
192 .cs_af = GPIO_AF5,
193 .rccmask = RCC_APB2ENR_SPI1EN,
194 .apbbus = APB2,
195#ifdef MODULE_PERIPH_DMA
196 .tx_dma = 1,
197 .tx_dma_chan = 3,
198 .rx_dma = 0,
199 .rx_dma_chan = 3,
200#endif
201 },
202 {
203 .dev = SPI2,
204 .mosi_pin = GPIO_PIN(PORT_B, 15),
205 .miso_pin = GPIO_PIN(PORT_C, 2),
206 .sclk_pin = GPIO_PIN(PORT_B, 13),
207 .cs_pin = GPIO_PIN(PORT_B, 12),
208 .mosi_af = GPIO_AF5,
209 .miso_af = GPIO_AF5,
210 .sclk_af = GPIO_AF5,
211 .cs_af = GPIO_AF5,
212 .rccmask = RCC_APB1ENR_SPI2EN,
213 .apbbus = APB1,
214#ifdef MODULE_PERIPH_DMA
215 .tx_dma = 3,
216 .tx_dma_chan = 0,
217 .rx_dma = 2,
218 .rx_dma_chan = 0,
219#endif
220 }
221};
222
223#define SPI_NUMOF ARRAY_SIZE(spi_config)
225
247static const adc_conf_t adc_config[] = {
248 { .pin = GPIO_PIN(PORT_A, 3), .dev = 0, .chan = 3 }, /* ADC123_IN3 */
249 { .pin = GPIO_PIN(PORT_C, 0), .dev = 0, .chan = 10 }, /* ADC123_IN10 */
250 { .pin = GPIO_PIN(PORT_C, 3), .dev = 0, .chan = 13 }, /* ADC123_IN13 */
251 { .pin = GPIO_PIN(PORT_F, 3), .dev = 2, .chan = 9 }, /* ADC3_IN9 */
252 { .pin = GPIO_PIN(PORT_F, 5), .dev = 2, .chan = 15 }, /* ADC3_IN15 */
253 { .pin = GPIO_PIN(PORT_F, 10), .dev = 2, .chan = 8 }, /* ADC3_IN8 */
254 { .pin = GPIO_UNDEF, .dev = 0, .chan = 18 }, /* VBAT */
255};
256
260#define VBAT_ADC ADC_LINE(6)
261
265#define ADC_NUMOF ARRAY_SIZE(adc_config)
266
268
273static const eth_conf_t eth_config = {
274 .mode = RMII,
276 .dma = 6,
277 .dma_chan = 8,
278 .phy_addr = 0x00,
279 .pins = {
280 GPIO_PIN(PORT_G, 13),
281 GPIO_PIN(PORT_B, 13),
282 GPIO_PIN(PORT_G, 11),
283 GPIO_PIN(PORT_C, 4),
284 GPIO_PIN(PORT_C, 5),
285 GPIO_PIN(PORT_A, 7),
286 GPIO_PIN(PORT_C, 1),
287 GPIO_PIN(PORT_A, 2),
288 GPIO_PIN(PORT_A, 1),
289 }
290};
291
292#define ETH_DMA_ISR isr_dma2_stream0
293
295
296#ifdef __cplusplus
297}
298#endif
299
@ PORT_B
port B
Definition periph_cpu.h:44
@ PORT_G
port G
Definition periph_cpu.h:49
@ PORT_C
port C
Definition periph_cpu.h:45
@ 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
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Common configuration for STM32 I2C.
Common configuration for STM32 OTG FS peripheral.
@ RMII
Configuration for RMII.
Definition cpu_eth.h:36
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:102
@ GPIO_AF2
use alternate function 2
Definition cpu_gpio.h:103
@ GPIO_AF5
use alternate function 5
Definition cpu_gpio.h:106
@ GPIO_AF8
use alternate function 8
Definition cpu_gpio.h:110
@ 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
#define MII_BMCR_FULL_DPLX
Set for full duplex.
Definition mii.h:68
#define MII_BMCR_SPEED_100
Set speed to 100 Mbps.
Definition mii.h:72
Interface definition for MII/RMII h.
ADC device configuration.
Definition periph_cpu.h:374
DMA configuration.
Definition cpu_dma.h:31
Ethernet Peripheral configuration.
Definition cpu_eth.h:43
PWM device configuration.
SPI device configuration.
Definition periph_cpu.h:333
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214