From b2c3df3381e17021dd94c9c3b0682e4b49f6b3d2 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Sat, 22 Dec 2018 19:50:40 +0100 Subject: [PATCH 1/2] cpu/stm32/gpio: power up port G with L4 Co-authored-by: Vincent Dupont --- cpu/stm32_common/periph/gpio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cpu/stm32_common/periph/gpio.c b/cpu/stm32_common/periph/gpio.c index 86e630d0eb..de3993390a 100644 --- a/cpu/stm32_common/periph/gpio.c +++ b/cpu/stm32_common/periph/gpio.c @@ -85,6 +85,13 @@ int gpio_init(gpio_t pin, gpio_mode_t mode) periph_clk_en(IOP, (RCC_IOPENR_GPIOAEN << _port_num(pin))); #elif defined (CPU_FAM_STM32L4) periph_clk_en(AHB2, (RCC_AHB2ENR_GPIOAEN << _port_num(pin))); +#ifdef PWR_CR2_IOSV + if (port == GPIOG) { + /* Port G requires external power supply */ + periph_clk_en(APB1, RCC_APB1ENR1_PWREN); + PWR->CR2 |= PWR_CR2_IOSV; + } +#endif /* PWR_CR2_IOSV */ #else periph_clk_en(AHB1, (RCC_AHB1ENR_GPIOAEN << _port_num(pin))); #endif From f682476c87a8c543b57df12325e6cc8e5076edd5 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Tue, 22 May 2018 15:33:58 +0200 Subject: [PATCH 2/2] boards/nucleo-l496zg: adapt conf to lpuart driver Co-authored-by: Vincent Dupont --- boards/nucleo-l496zg/Makefile.dep | 2 ++ boards/nucleo-l496zg/Makefile.features | 2 +- boards/nucleo-l496zg/Makefile.include | 2 +- boards/nucleo-l496zg/include/periph_conf.h | 17 +++++++++++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/boards/nucleo-l496zg/Makefile.dep b/boards/nucleo-l496zg/Makefile.dep index 7294858272..f41bf0f86b 100644 --- a/boards/nucleo-l496zg/Makefile.dep +++ b/boards/nucleo-l496zg/Makefile.dep @@ -1 +1,3 @@ +FEATURES_REQUIRED += periph_lpuart + include $(RIOTBOARD)/common/nucleo/Makefile.dep diff --git a/boards/nucleo-l496zg/Makefile.features b/boards/nucleo-l496zg/Makefile.features index ff74d0e79c..67dc676d95 100644 --- a/boards/nucleo-l496zg/Makefile.features +++ b/boards/nucleo-l496zg/Makefile.features @@ -4,7 +4,7 @@ FEATURES_PROVIDED += periph_rtc FEATURES_PROVIDED += periph_rtt FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer -FEATURES_PROVIDED += periph_uart +FEATURES_PROVIDED += periph_uart periph_lpuart # load the common Makefile.features for Nucleo boards include $(RIOTBOARD)/common/nucleo144/Makefile.features diff --git a/boards/nucleo-l496zg/Makefile.include b/boards/nucleo-l496zg/Makefile.include index a7612cbeba..51050cea5b 100644 --- a/boards/nucleo-l496zg/Makefile.include +++ b/boards/nucleo-l496zg/Makefile.include @@ -4,7 +4,7 @@ export CPU_MODEL = stm32l496zg # stdio is not available over st-link but on the Arduino TX/RX pins # A serial to USB converter plugged to the host is required -PORT_LINUX ?= /dev/ttyUSB0 +PORT_LINUX ?= /dev/ttyACM0 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) # load the common Makefile.include for Nucleo boards diff --git a/boards/nucleo-l496zg/include/periph_conf.h b/boards/nucleo-l496zg/include/periph_conf.h index 851b9de54f..0366faa80b 100644 --- a/boards/nucleo-l496zg/include/periph_conf.h +++ b/boards/nucleo-l496zg/include/periph_conf.h @@ -112,6 +112,18 @@ static const timer_conf_t timer_config[] = { * @{ */ static const uart_conf_t uart_config[] = { + { + .dev = LPUART1, + .rcc_mask = RCC_APB1ENR2_LPUART1EN, + .rx_pin = GPIO_PIN(PORT_G, 8), + .tx_pin = GPIO_PIN(PORT_G, 7), + .rx_af = GPIO_AF8, + .tx_af = GPIO_AF8, + .bus = APB12, + .irqn = LPUART1_IRQn, + .type = STM32_LPUART, + .clk_src = 0, + }, { .dev = USART3, .rcc_mask = RCC_APB1ENR1_USART3EN, @@ -130,8 +142,9 @@ static const uart_conf_t uart_config[] = { } }; -#define UART_0_ISR (isr_usart3) -#define UART_0_DMA_ISR (isr_dma1_stream5) +#define UART_0_ISR (isr_lpuart1) +#define UART_1_ISR (isr_usart3) +#define UART_1_DMA_ISR (isr_dma1_stream5) #define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0])) /** @} */