diff --git a/boards/nucleo-f412zg/Makefile.features b/boards/nucleo-f412zg/Makefile.features index 20126aaf30..e1b1b6cd0c 100644 --- a/boards/nucleo-f412zg/Makefile.features +++ b/boards/nucleo-f412zg/Makefile.features @@ -3,6 +3,7 @@ CPU_MODEL = stm32f412zg # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc +FEATURES_PROVIDED += periph_dma FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc diff --git a/boards/nucleo-f412zg/include/periph_conf.h b/boards/nucleo-f412zg/include/periph_conf.h index de32583fb9..b3e17a0ae3 100644 --- a/boards/nucleo-f412zg/include/periph_conf.h +++ b/boards/nucleo-f412zg/include/periph_conf.h @@ -31,6 +31,24 @@ extern "C" { #endif +/** + * @name DMA streams configuration + * @{ + */ +#ifdef MODULE_PERIPH_DMA +static const dma_conf_t dma_config[] = { + { .stream = 11 }, /* DMA2 Stream 3 - SPI1_TX */ + { .stream = 10 }, /* DMA2 Stream 2 - SPI1_RX */ +}; + +#define DMA_0_ISR isr_dma2_stream3 +#define DMA_1_ISR isr_dma2_stream2 + +#define DMA_NUMOF ARRAY_SIZE(dma_config) + +#endif /* MODULE_PERIPH_DMA */ +/** @} */ + /** * @name UART configuration * @{ @@ -143,17 +161,23 @@ static const uint8_t spi_divtable[2][5] = { static const spi_conf_t spi_config[] = { { - .dev = SPI1, - .mosi_pin = GPIO_PIN(PORT_A, 7), - .miso_pin = GPIO_PIN(PORT_A, 6), - .sclk_pin = GPIO_PIN(PORT_A, 5), - .cs_pin = GPIO_PIN(PORT_A, 4), - .mosi_af = GPIO_AF5, - .miso_af = GPIO_AF5, - .sclk_af = GPIO_AF5, - .cs_af = GPIO_AF5, - .rccmask = RCC_APB2ENR_SPI1EN, - .apbbus = APB2 + .dev = SPI1, + .mosi_pin = GPIO_PIN(PORT_A, 7), + .miso_pin = GPIO_PIN(PORT_A, 6), + .sclk_pin = GPIO_PIN(PORT_A, 5), + .cs_pin = GPIO_PIN(PORT_A, 4), + .mosi_af = GPIO_AF5, + .miso_af = GPIO_AF5, + .sclk_af = GPIO_AF5, + .cs_af = GPIO_AF5, + .rccmask = RCC_APB2ENR_SPI1EN, + .apbbus = APB2, +#ifdef MODULE_PERIPH_DMA + .tx_dma = 0, + .tx_dma_chan = 3, + .rx_dma = 1, + .rx_dma_chan = 3, +#endif } };