From b3645eb62ba5b51891c8a36381723857f6bd4d0e Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Thu, 13 Sep 2018 16:51:40 +0200 Subject: [PATCH] boards: stm32l496g_disco: Conform to default configuration guidelines Update stm32l496g_disco configuration to match with default configuration guidelines: -Deactivate features by default -Configure available connectors Signed-off-by: Erwan Gouriou --- boards/arm/stm32l496g_disco/Kconfig.defconfig | 24 +++++++++++++++++++ .../stm32l496g_disco/doc/stm32l496g_disco.rst | 11 +++++---- boards/arm/stm32l496g_disco/pinmux.c | 9 +++++++ .../arm/stm32l496g_disco/stm32l496g_disco.dts | 20 ++++++++++++++++ .../stm32l496g_disco/stm32l496g_disco.yaml | 5 ++++ .../stm32l496g_disco_defconfig | 3 --- drivers/pinmux/stm32/pinmux_stm32l4x.h | 8 +++++++ dts/arm/st/l4/stm32l4-pinctrl.dtsi | 6 +++++ 8 files changed, 79 insertions(+), 7 deletions(-) diff --git a/boards/arm/stm32l496g_disco/Kconfig.defconfig b/boards/arm/stm32l496g_disco/Kconfig.defconfig index bb4f48d4825..f7c76d5ed56 100644 --- a/boards/arm/stm32l496g_disco/Kconfig.defconfig +++ b/boards/arm/stm32l496g_disco/Kconfig.defconfig @@ -18,6 +18,30 @@ config UART_STM32_PORT_2 endif # UART_CONSOLE +if SERIAL + +config UART_STM32_LPUART_1 + default y + +endif # SERIAL + +if I2C + +config I2C_1 + default y + +endif # I2C + +if SPI + +config SPI_STM32_INTERRUPT + default y + +config SPI_1 + default y + +endif # SPI + if PWM config PWM_STM32_2 diff --git a/boards/arm/stm32l496g_disco/doc/stm32l496g_disco.rst b/boards/arm/stm32l496g_disco/doc/stm32l496g_disco.rst index b3522f3bba5..1b1960f1535 100644 --- a/boards/arm/stm32l496g_disco/doc/stm32l496g_disco.rst +++ b/boards/arm/stm32l496g_disco/doc/stm32l496g_disco.rst @@ -139,6 +139,8 @@ The Zephyr stm32l496g_disco board configuration supports the following hardware +-----------+------------+-------------------------------------+ | I2C | on-chip | i2c | +-----------+------------+-------------------------------------+ +| SPI | on-chip | spi | ++-----------+------------+-------------------------------------+ | PWM | on-chip | pwm | +-----------+------------+-------------------------------------+ @@ -160,10 +162,11 @@ For mode details please refer to `STM32L496G Discovery board User Manual`_. Default Zephyr Peripheral Mapping: ---------------------------------- -- UART_1_TX : PB6 -- UART_1_RX : PG10 -- UART_2_TX : PA2 -- UART_2_RX : PD6 +- UART_1 TX/RX : PB6/PG10 +- UART_2 TX/RX : PA2/PD6 (ST-Link Virtual Port Com) +- LPUART_1 TX/RX : PG7/PG8 (Arduino Serial) +- I2C1 SCL/SDA : PB8/PB7 (Arduino I2C) +- SPI1 SCK/MISO/MOSI : PA5/PB4/PB5 (Arduino SPI) - I2C_1_SCL : PB8 - I2C_1_SDA : PB7 - PWM_2_CH1 : PA0 diff --git a/boards/arm/stm32l496g_disco/pinmux.c b/boards/arm/stm32l496g_disco/pinmux.c index 247dd942c72..96fec266f82 100644 --- a/boards/arm/stm32l496g_disco/pinmux.c +++ b/boards/arm/stm32l496g_disco/pinmux.c @@ -23,10 +23,19 @@ static const struct pin_config pinconf[] = { {STM32_PIN_PA2, STM32L4X_PINMUX_FUNC_PA2_USART2_TX}, {STM32_PIN_PD6, STM32L4X_PINMUX_FUNC_PD6_USART2_RX}, #endif /* CONFIG_UART_STM32_PORT_2 */ +#ifdef CONFIG_UART_STM32_LPUART_1 + {STM32_PIN_PG7, STM32L4X_PINMUX_FUNC_PG7_LPUART1_TX}, + {STM32_PIN_PG8, STM32L4X_PINMUX_FUNC_PG8_LPUART1_RX}, +#endif /* CONFIG_UART_STM32_LPUART_1 */ #ifdef CONFIG_I2C_1 {STM32_PIN_PB8, STM32L4X_PINMUX_FUNC_PB8_I2C1_SCL}, {STM32_PIN_PB7, STM32L4X_PINMUX_FUNC_PB7_I2C1_SDA}, #endif /* CONFIG_I2C_1 */ +#ifdef CONFIG_SPI_1 + {STM32_PIN_PA5, STM32L4X_PINMUX_FUNC_PA5_SPI1_SCK}, + {STM32_PIN_PB4, STM32L4X_PINMUX_FUNC_PB4_SPI1_MISO}, + {STM32_PIN_PB5, STM32L4X_PINMUX_FUNC_PB5_SPI1_MOSI}, +#endif /* CONFIG_SPI_1 */ #ifdef CONFIG_PWM_STM32_2 {STM32_PIN_PA0, STM32L4X_PINMUX_FUNC_PA0_PWM2_CH1}, #endif /* CONFIG_PWM_STM32_2 */ diff --git a/boards/arm/stm32l496g_disco/stm32l496g_disco.dts b/boards/arm/stm32l496g_disco/stm32l496g_disco.dts index a2a456887d4..56ca86fb1af 100644 --- a/boards/arm/stm32l496g_disco/stm32l496g_disco.dts +++ b/boards/arm/stm32l496g_disco/stm32l496g_disco.dts @@ -55,6 +55,10 @@ }; }; +arduino_i2c: &i2c1 {}; +arduino_spi: &spi1 {}; +arduino_serial: &lpuart1 {}; + &usart1 { current-speed = <115200>; pinctrl-0 = <&usart1_pins_c>; @@ -69,6 +73,13 @@ status = "ok"; }; +&lpuart1 { + current-speed = <115200>; + pinctrl-0 = <&usart1_pins_c>; + pinctrl-names = "default"; + status = "ok"; +}; + &timers2 { status = "ok"; @@ -77,6 +88,15 @@ }; }; +&i2c1 { + status = "ok"; + clock-frequency = ; +}; + +&spi1 { + status = "ok"; +}; + &rtc { status = "ok"; }; diff --git a/boards/arm/stm32l496g_disco/stm32l496g_disco.yaml b/boards/arm/stm32l496g_disco/stm32l496g_disco.yaml index 3956958e948..df5aca520bd 100644 --- a/boards/arm/stm32l496g_disco/stm32l496g_disco.yaml +++ b/boards/arm/stm32l496g_disco/stm32l496g_disco.yaml @@ -5,5 +5,10 @@ arch: arm toolchain: - zephyr - gnuarmemb +ram: 320 +flash: 1024 supported: - pwm + - i2c + - spi + - gpio diff --git a/boards/arm/stm32l496g_disco/stm32l496g_disco_defconfig b/boards/arm/stm32l496g_disco/stm32l496g_disco_defconfig index 0c382dd151b..b80b170e0a6 100644 --- a/boards/arm/stm32l496g_disco/stm32l496g_disco_defconfig +++ b/boards/arm/stm32l496g_disco/stm32l496g_disco_defconfig @@ -34,6 +34,3 @@ CONFIG_CLOCK_STM32_APB2_PRESCALER=1 # console CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y - -#enable pwm -CONFIG_PWM=y diff --git a/drivers/pinmux/stm32/pinmux_stm32l4x.h b/drivers/pinmux/stm32/pinmux_stm32l4x.h index 66af3902979..06d38cfd6be 100644 --- a/drivers/pinmux/stm32/pinmux_stm32l4x.h +++ b/drivers/pinmux/stm32/pinmux_stm32l4x.h @@ -55,8 +55,12 @@ (STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL) #define STM32L4X_PINMUX_FUNC_PB3_SPI3_SCK \ (STM32_PINMUX_ALT_FUNC_6 | STM32_PUSHPULL_NOPULL) +#define STM32L4X_PINMUX_FUNC_PB4_SPI1_MISO \ + (STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL) #define STM32L4X_PINMUX_FUNC_PB4_SPI3_MISO \ (STM32_PINMUX_ALT_FUNC_6 | STM32_PUSHPULL_NOPULL) +#define STM32L4X_PINMUX_FUNC_PB5_SPI1_MOSI \ + (STM32_PINMUX_ALT_FUNC_5 | STM32_PUSHPULL_NOPULL) #define STM32L4X_PINMUX_FUNC_PB5_SPI3_MOSI \ (STM32_PINMUX_ALT_FUNC_6 | STM32_PUSHPULL_NOPULL) #define STM32L4X_PINMUX_FUNC_PB6_I2C1_SCL \ @@ -127,6 +131,10 @@ /* Port G */ #define STM32L4X_PINMUX_FUNC_PG7_I2C3_SCL \ (STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP) +#define STM32L4X_PINMUX_FUNC_PG7_LPUART1_TX \ + (STM32_PINMUX_ALT_FUNC_8 | STM32_PUSHPULL_PULLUP) +#define STM32L4X_PINMUX_FUNC_PG8_LPUART1_RX \ + (STM32_PINMUX_ALT_FUNC_8 | STM32_PUPDR_NO_PULL) #define STM32L4X_PINMUX_FUNC_PG8_I2C3_SDA \ (STM32_PINMUX_ALT_FUNC_4 | STM32_OPENDRAIN_PULLUP) #define STM32L4X_PINMUX_FUNC_PG9_USART1_TX \ diff --git a/dts/arm/st/l4/stm32l4-pinctrl.dtsi b/dts/arm/st/l4/stm32l4-pinctrl.dtsi index 3ef10cbb8fc..a7d57d3b320 100644 --- a/dts/arm/st/l4/stm32l4-pinctrl.dtsi +++ b/dts/arm/st/l4/stm32l4-pinctrl.dtsi @@ -63,6 +63,12 @@ tx = ; }; }; + lpuart1_pins_a: lpuart1_a { + rx_tx { + rx = ; + tx = ; + }; + }; can_pins_a: can_a { rx_tx { rx = ;