From 859c1285ccb4f7e9052b973626e6a20374868ef9 Mon Sep 17 00:00:00 2001 From: hugues Date: Thu, 13 Aug 2020 00:22:09 +0200 Subject: [PATCH 1/2] boards/nucleo-f303k8: bugfix: spi is AF5, not AF0 --- boards/nucleo-f303k8/include/periph_conf.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/boards/nucleo-f303k8/include/periph_conf.h b/boards/nucleo-f303k8/include/periph_conf.h index 81dcb57abc..bc41271617 100644 --- a/boards/nucleo-f303k8/include/periph_conf.h +++ b/boards/nucleo-f303k8/include/periph_conf.h @@ -129,10 +129,10 @@ static const spi_conf_t spi_config[] = { .miso_pin = GPIO_PIN(PORT_B, 4), .sclk_pin = GPIO_PIN(PORT_B, 3), .cs_pin = GPIO_UNDEF, - .mosi_af = GPIO_AF0, - .miso_af = GPIO_AF0, - .sclk_af = GPIO_AF0, - .cs_af = GPIO_AF0, + .mosi_af = GPIO_AF5, + .miso_af = GPIO_AF5, + .sclk_af = GPIO_AF5, + .cs_af = GPIO_AF5, .rccmask = RCC_APB2ENR_SPI1EN, .apbbus = APB2 } From bdf9d8eee650163dfc995b4600df9955f63ba586 Mon Sep 17 00:00:00 2001 From: hugues Date: Fri, 14 Aug 2020 15:57:40 +0200 Subject: [PATCH 2/2] boards/nucleo-f303k8: DMA feature added --- boards/nucleo-f303k8/Kconfig | 1 + boards/nucleo-f303k8/Makefile.features | 1 + boards/nucleo-f303k8/include/periph_conf.h | 39 ++++++++++++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/boards/nucleo-f303k8/Kconfig b/boards/nucleo-f303k8/Kconfig index 467e71339a..fbaa248d1b 100644 --- a/boards/nucleo-f303k8/Kconfig +++ b/boards/nucleo-f303k8/Kconfig @@ -15,6 +15,7 @@ config BOARD_NUCLEO_F303K8 select CPU_MODEL_STM32F303K8 # Put defined MCU peripherals here (in alphabetical order) + select HAS_PERIPH_DMA select HAS_PERIPH_PWM select HAS_PERIPH_RTC select HAS_PERIPH_SPI diff --git a/boards/nucleo-f303k8/Makefile.features b/boards/nucleo-f303k8/Makefile.features index 6cdd370e42..69a32f11c7 100644 --- a/boards/nucleo-f303k8/Makefile.features +++ b/boards/nucleo-f303k8/Makefile.features @@ -2,6 +2,7 @@ CPU = stm32 CPU_MODEL = stm32f303k8 # Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_dma FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc FEATURES_PROVIDED += periph_spi diff --git a/boards/nucleo-f303k8/include/periph_conf.h b/boards/nucleo-f303k8/include/periph_conf.h index bc41271617..a3cdb158a0 100644 --- a/boards/nucleo-f303k8/include/periph_conf.h +++ b/boards/nucleo-f303k8/include/periph_conf.h @@ -55,6 +55,25 @@ extern "C" { #define CLOCK_PLL_MUL (16) /** @} */ +/** + * @name DMA streams configuration + * @{ + */ +static const dma_conf_t dma_config[] = { + { .stream = 1 }, /* DMA1 Channel 2 - SPI1_RX */ + { .stream = 2 }, /* DMA1 Channel 3 - SPI1_TX */ + { .stream = 3 }, /* DMA1 Channel 4 - USART1_TX */ + { .stream = 6 }, /* DMA1 Channel 7 - USART2_TX */ +}; + +#define DMA_0_ISR isr_dma1_channel2 +#define DMA_1_ISR isr_dma1_channel3 +#define DMA_2_ISR isr_dma1_channel4 +#define DMA_3_ISR isr_dma1_channel7 + +#define DMA_NUMOF ARRAY_SIZE(dma_config) +/** @} */ + /** * @name UART configuration * @{ @@ -68,7 +87,11 @@ static const uart_conf_t uart_config[] = { .rx_af = GPIO_AF7, .tx_af = GPIO_AF7, .bus = APB1, - .irqn = USART2_IRQn + .irqn = USART2_IRQn, +#ifdef MODULE_PERIPH_DMA + .dma = 3, + .dma_chan = DMA_CHAN_CONFIG_UNSUPPORTED +#endif }, { .dev = USART1, @@ -78,7 +101,11 @@ static const uart_conf_t uart_config[] = { .rx_af = GPIO_AF7, .tx_af = GPIO_AF7, .bus = APB2, - .irqn = USART1_IRQn + .irqn = USART1_IRQn, +#ifdef MODULE_PERIPH_DMA + .dma = 2, + .dma_chan = DMA_CHAN_CONFIG_UNSUPPORTED +#endif } }; @@ -134,7 +161,13 @@ static const spi_conf_t spi_config[] = { .sclk_af = GPIO_AF5, .cs_af = GPIO_AF5, .rccmask = RCC_APB2ENR_SPI1EN, - .apbbus = APB2 + .apbbus = APB2, +#ifdef MODULE_PERIPH_DMA + .tx_dma = 1, + .tx_dma_chan = DMA_CHAN_CONFIG_UNSUPPORTED, + .rx_dma = 0, + .rx_dma_chan = DMA_CHAN_CONFIG_UNSUPPORTED +#endif } };