boards: stm32l562e_dk: add support for I2C

Add i2c1 interface for stm32l552xx and stm32l562xx microcontrollers
and enable i2c1 that connects to lsm6dso sensor module on the
stm32l562e_dk board.

Signed-off-by: Yestin Sun <sunyi0804@gmail.com>
This commit is contained in:
Yestin Sun 2020-11-11 19:24:55 -08:00 committed by Anas Nashif
commit b31b1d133e
5 changed files with 36 additions and 0 deletions

View file

@ -162,6 +162,8 @@ The Zephyr stm32l562e_dk board configuration supports the following hardware fea
+-----------+------------+-------------------------------------+ +-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio | | GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+ +-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
Other hardware features are not yet supported on this Zephyr port. Other hardware features are not yet supported on this Zephyr port.
@ -181,6 +183,7 @@ Default Zephyr Peripheral Mapping:
---------------------------------- ----------------------------------
- USART_1 TX/RX : PA9/PA10 - USART_1 TX/RX : PA9/PA10
- I2C_1 SCL/SDA : PB6/PB7
- USER_PB : PC13 - USER_PB : PC13
- LD10 : PG12 - LD10 : PG12

View file

@ -7,5 +7,7 @@ toolchain:
- gnuarmemb - gnuarmemb
supported: supported:
- gpio - gpio
- i2c
- lsm6dso
ram: 192 ram: 192
flash: 512 flash: 512

View file

@ -35,3 +35,16 @@
current-speed = <115200>; current-speed = <115200>;
status = "okay"; status = "okay";
}; };
&i2c1 {
pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
lsm6dso@6a {
compatible = "st,lsm6dso";
reg = <0x6a>;
irq-gpios = <&gpiof 3 GPIO_ACTIVE_HIGH>;
label = "LSM6DSO";
};
};

View file

@ -8,6 +8,7 @@
#include <arm/armv8-m.dtsi> #include <arm/armv8-m.dtsi>
#include <dt-bindings/clock/stm32_clock.h> #include <dt-bindings/clock/stm32_clock.h>
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/i2c/i2c.h>
#include <dt-bindings/pwm/pwm.h> #include <dt-bindings/pwm/pwm.h>
/ { / {
@ -190,6 +191,19 @@
status = "disabled"; status = "disabled";
label = "LPUART_1"; label = "LPUART_1";
}; };
i2c1: i2c@40005400 {
compatible = "st,stm32-i2c-v2";
clock-frequency = <I2C_BITRATE_STANDARD>;
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40005400 0x400>;
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>;
interrupts = <55 0>, <56 0>;
interrupt-names = "event", "error";
status = "disabled";
label= "I2C_1";
};
}; };
}; };

View file

@ -43,6 +43,10 @@
#include <stm32l5xx_ll_gpio.h> #include <stm32l5xx_ll_gpio.h>
#endif #endif
#ifdef CONFIG_I2C_STM32
#include <stm32l5xx_ll_i2c.h>
#endif
#ifdef CONFIG_SERIAL_HAS_DRIVER #ifdef CONFIG_SERIAL_HAS_DRIVER
#include <stm32l5xx_ll_usart.h> #include <stm32l5xx_ll_usart.h>
#include <stm32l5xx_ll_lpuart.h> #include <stm32l5xx_ll_lpuart.h>