From 68616f23d8bd3802faa91514fe028c88d5f3846a Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Fri, 16 Feb 2024 15:59:44 +0100 Subject: [PATCH] boards: nucleo_h563zi: Enable I2C Enable i2c1 on nucleo_h563zi (arduino_i2c). Additionally provide a test configuration for i2c_target_api. Signed-off-by: Erwan Gouriou --- .../nucleo_h563zi/arduino_r3_connector.dtsi | 1 + boards/st/nucleo_h563zi/doc/index.rst | 2 ++ .../nucleo_h563zi/nucleo_h563zi-common.dtsi | 6 ++++ boards/st/nucleo_h563zi/nucleo_h563zi.yaml | 1 + .../i2c_target_api/boards/nucleo_h563zi.conf | 2 ++ .../boards/nucleo_h563zi.overlay | 36 +++++++++++++++++++ 6 files changed, 48 insertions(+) create mode 100644 tests/drivers/i2c/i2c_target_api/boards/nucleo_h563zi.conf create mode 100644 tests/drivers/i2c/i2c_target_api/boards/nucleo_h563zi.overlay diff --git a/boards/st/nucleo_h563zi/arduino_r3_connector.dtsi b/boards/st/nucleo_h563zi/arduino_r3_connector.dtsi index cb56530d7e8..fa2515d6d0b 100644 --- a/boards/st/nucleo_h563zi/arduino_r3_connector.dtsi +++ b/boards/st/nucleo_h563zi/arduino_r3_connector.dtsi @@ -38,3 +38,4 @@ arduino_serial: &lpuart1 {}; arduino_spi: &spi1 {}; +arduino_i2c: &i2c1 {}; diff --git a/boards/st/nucleo_h563zi/doc/index.rst b/boards/st/nucleo_h563zi/doc/index.rst index 9be05804330..e707e81fefa 100644 --- a/boards/st/nucleo_h563zi/doc/index.rst +++ b/boards/st/nucleo_h563zi/doc/index.rst @@ -168,6 +168,8 @@ The Zephyr nucleo_h563zi board configuration supports the following hardware fea +-----------+------------+-------------------------------------+ | SPI | on-chip | spi bus | +-----------+------------+-------------------------------------+ +| I2C | on-chip | i2c bus | ++-----------+------------+-------------------------------------+ | UART | on-chip | serial port-polling; | | | | serial port-interrupt | +-----------+------------+-------------------------------------+ diff --git a/boards/st/nucleo_h563zi/nucleo_h563zi-common.dtsi b/boards/st/nucleo_h563zi/nucleo_h563zi-common.dtsi index 9ffb5c9fc0c..28b72527179 100644 --- a/boards/st/nucleo_h563zi/nucleo_h563zi-common.dtsi +++ b/boards/st/nucleo_h563zi/nucleo_h563zi-common.dtsi @@ -72,6 +72,12 @@ status = "okay"; }; +&i2c1 { + pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>; + pinctrl-names = "default"; + status = "okay"; +}; + &rcc { clocks = <&pll>; clock-frequency = ; diff --git a/boards/st/nucleo_h563zi/nucleo_h563zi.yaml b/boards/st/nucleo_h563zi/nucleo_h563zi.yaml index 9e04cd2b7de..0130798df9d 100644 --- a/boards/st/nucleo_h563zi/nucleo_h563zi.yaml +++ b/boards/st/nucleo_h563zi/nucleo_h563zi.yaml @@ -22,4 +22,5 @@ supported: - usb_device - usb - rtc + - i2c vendor: st diff --git a/tests/drivers/i2c/i2c_target_api/boards/nucleo_h563zi.conf b/tests/drivers/i2c/i2c_target_api/boards/nucleo_h563zi.conf new file mode 100644 index 00000000000..34b2571d125 --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/nucleo_h563zi.conf @@ -0,0 +1,2 @@ +CONFIG_I2C_STM32_INTERRUPT=y +CONFIG_I2C_VIRTUAL=n diff --git a/tests/drivers/i2c/i2c_target_api/boards/nucleo_h563zi.overlay b/tests/drivers/i2c/i2c_target_api/boards/nucleo_h563zi.overlay new file mode 100644 index 00000000000..02574be9b3e --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/nucleo_h563zi.overlay @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2020 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/* I2C bus pins are exposed on the ST morpho header. + * + * Bus SDA SCL + * Pin Hdr Pin Hdr + * i2c1 PB9 CN7:4 PB8 CN7:2 + * i2c2 PB11 CN10:34 PB10 CN10:32 + * + * Short Pin PB9 to PB11, and PB8 to PB10, for the test to pass. + */ + +&i2c2 { + pinctrl-0 = <&i2c2_scl_pf1 &i2c2_sda_pf0>; + pinctrl-names = "default"; + status = "okay"; + eeprom0: eeprom@54 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x54>; + size = <1024>; + }; +}; + +&i2c1 { + pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>; + pinctrl-names = "default"; + status = "okay"; + eeprom1: eeprom@56 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x56>; + size = <1024>; + }; +};