From c78acb75e491008bbddfe1c3418cd6e925a62bd5 Mon Sep 17 00:00:00 2001 From: Pavlo Hamov Date: Fri, 26 Jul 2019 01:02:43 +0300 Subject: [PATCH] boards: stm32_min_dev enable I2C_2 Add support of i2c peripheral for mini_dev boards Signed-off-by: Pavlo Hamov --- boards/arm/stm32_min_dev/Kconfig.defconfig | 3 +++ boards/arm/stm32_min_dev/doc/index.rst | 10 ++++++++++ boards/arm/stm32_min_dev/pinmux.c | 4 ++++ boards/arm/stm32_min_dev/stm32_min_dev.dtsi | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/boards/arm/stm32_min_dev/Kconfig.defconfig b/boards/arm/stm32_min_dev/Kconfig.defconfig index a202702df68..5b6b319bfec 100644 --- a/boards/arm/stm32_min_dev/Kconfig.defconfig +++ b/boards/arm/stm32_min_dev/Kconfig.defconfig @@ -23,6 +23,9 @@ if I2C config I2C_1 default y +config I2C_2 + default y + endif # I2C if PWM diff --git a/boards/arm/stm32_min_dev/doc/index.rst b/boards/arm/stm32_min_dev/doc/index.rst index 7d9313aebd8..29ea9bfc976 100644 --- a/boards/arm/stm32_min_dev/doc/index.rst +++ b/boards/arm/stm32_min_dev/doc/index.rst @@ -108,6 +108,16 @@ The stm32_min_dev board configuration supports the following hardware features: Other hardware features are not supported by the Zephyr kernel. +I2C +=== + +The STM32 Minimum Development Board board supports two I2C devices. The default +I2C mapping for Zephyr is: + +- I2C1_SCL : PB6 +- I2C1_SDA : PB7 +- I2C2_SCL : PB10 +- I2C2_SDA : PB11 Programming and Debugging ************************* diff --git a/boards/arm/stm32_min_dev/pinmux.c b/boards/arm/stm32_min_dev/pinmux.c index 0483ca8eb2f..d9651266383 100644 --- a/boards/arm/stm32_min_dev/pinmux.c +++ b/boards/arm/stm32_min_dev/pinmux.c @@ -30,6 +30,10 @@ static const struct pin_config pinconf[] = { {STM32_PIN_PB6, STM32F1_PINMUX_FUNC_PB6_I2C1_SCL}, {STM32_PIN_PB7, STM32F1_PINMUX_FUNC_PB7_I2C1_SDA}, #endif /* CONFIG_I2C_1 */ +#ifdef CONFIG_I2C_2 + {STM32_PIN_PB10, STM32F1_PINMUX_FUNC_PB10_I2C2_SCL}, + {STM32_PIN_PB11, STM32F1_PINMUX_FUNC_PB11_I2C2_SDA}, +#endif /* CONFIG_I2C_2 */ #ifdef CONFIG_PWM_STM32_1 {STM32_PIN_PA8, STM32F1_PINMUX_FUNC_PA8_PWM1_CH1}, #endif /* CONFIG_PWM_STM32_1 */ diff --git a/boards/arm/stm32_min_dev/stm32_min_dev.dtsi b/boards/arm/stm32_min_dev/stm32_min_dev.dtsi index 8f28c9749c3..9910042bfea 100644 --- a/boards/arm/stm32_min_dev/stm32_min_dev.dtsi +++ b/boards/arm/stm32_min_dev/stm32_min_dev.dtsi @@ -55,6 +55,11 @@ clock-frequency = ; }; +&i2c2 { + status = "okay"; + clock-frequency = ; +}; + &spi1 { status = "okay"; };