From 3756fa3c1aff4fe9d3f4055bf0e81150ec3e2b45 Mon Sep 17 00:00:00 2001 From: Lucien Zhao Date: Wed, 17 Dec 2025 23:01:03 +0800 Subject: [PATCH] boards: nxp: frdm_mcxe247: add i2c feature - support accel feature using lpi2c0 and enable accel cases: accel_trig/accel_polling - enable i2c_target_api case using lpi2c0 and lpi2c1 Signed-off-by: Lucien Zhao --- .../frdm_mcxe247/frdm_mcxe247-pinctrl.dtsi | 20 ++++++++++++ boards/nxp/frdm_mcxe247/frdm_mcxe247.dts | 19 ++++++++++++ boards/nxp/frdm_mcxe247/frdm_mcxe247.yaml | 1 + .../accel_trig/boards/frdm_mcxe247.conf | 1 + .../accel_trig/boards/frdm_mcxe247.overlay | 11 +++++++ .../boards/frdm_mcxe247.overlay | 31 +++++++++++++++++++ 6 files changed, 83 insertions(+) create mode 100644 samples/sensor/accel_trig/boards/frdm_mcxe247.conf create mode 100644 samples/sensor/accel_trig/boards/frdm_mcxe247.overlay create mode 100644 tests/drivers/i2c/i2c_target_api/boards/frdm_mcxe247.overlay diff --git a/boards/nxp/frdm_mcxe247/frdm_mcxe247-pinctrl.dtsi b/boards/nxp/frdm_mcxe247/frdm_mcxe247-pinctrl.dtsi index d7d5f186822..cfa57658e2b 100644 --- a/boards/nxp/frdm_mcxe247/frdm_mcxe247-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxe247/frdm_mcxe247-pinctrl.dtsi @@ -26,6 +26,26 @@ }; }; + pinmux_lpi2c0: pinmux_lpi2c0 { + group0 { + pinmux = , + ; + drive-strength = "low"; + slew-rate = "slow"; + input-enable; + }; + }; + + pinmux_lpi2c1: pinmux_lpi2c1 { + group0 { + pinmux = , + ; + drive-strength = "low"; + slew-rate = "slow"; + input-enable; + }; + }; + pinmux_adc0: pinmux_adc0 { group0 { pinmux = , diff --git a/boards/nxp/frdm_mcxe247/frdm_mcxe247.dts b/boards/nxp/frdm_mcxe247/frdm_mcxe247.dts index ece371f6dc0..ef8498491a5 100644 --- a/boards/nxp/frdm_mcxe247/frdm_mcxe247.dts +++ b/boards/nxp/frdm_mcxe247/frdm_mcxe247.dts @@ -22,6 +22,7 @@ sw0 = &user_button_2; sw1 = &user_button_3; rtc = &counter_rtc; + accel0 = &fxls8974; }; chosen { @@ -221,6 +222,24 @@ status = "okay"; }; +&lpi2c0 { + pinctrl-0 = <&pinmux_lpi2c0>; + pinctrl-names = "default"; + status = "okay"; + + fxls8974: fxls8974@18 { + compatible = "nxp,fxls8974"; + reg = <0x18>; + status = "okay"; + }; +}; + +&lpi2c1 { + pinctrl-0 = <&pinmux_lpi2c1>; + pinctrl-names = "default"; + status = "okay"; +}; + &edma { status = "okay"; }; diff --git a/boards/nxp/frdm_mcxe247/frdm_mcxe247.yaml b/boards/nxp/frdm_mcxe247/frdm_mcxe247.yaml index e9517905ece..078eb94b0a3 100644 --- a/boards/nxp/frdm_mcxe247/frdm_mcxe247.yaml +++ b/boards/nxp/frdm_mcxe247/frdm_mcxe247.yaml @@ -15,6 +15,7 @@ toolchain: - gnuarmemb supported: - uart + - i2c - gpio - adc - arduino_gpio diff --git a/samples/sensor/accel_trig/boards/frdm_mcxe247.conf b/samples/sensor/accel_trig/boards/frdm_mcxe247.conf new file mode 100644 index 00000000000..9dc813d038c --- /dev/null +++ b/samples/sensor/accel_trig/boards/frdm_mcxe247.conf @@ -0,0 +1 @@ +CONFIG_FXLS8974_TRIGGER_OWN_THREAD=y diff --git a/samples/sensor/accel_trig/boards/frdm_mcxe247.overlay b/samples/sensor/accel_trig/boards/frdm_mcxe247.overlay new file mode 100644 index 00000000000..87db13bb47f --- /dev/null +++ b/samples/sensor/accel_trig/boards/frdm_mcxe247.overlay @@ -0,0 +1,11 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright 2025 NXP + */ + +&fxls8974 { + status = "okay"; + int1-gpios = <&gpioe 14 GPIO_ACTIVE_LOW>; + int2-gpios = <&gpioe 11 GPIO_ACTIVE_LOW>; +}; diff --git a/tests/drivers/i2c/i2c_target_api/boards/frdm_mcxe247.overlay b/tests/drivers/i2c/i2c_target_api/boards/frdm_mcxe247.overlay new file mode 100644 index 00000000000..2636ce02dff --- /dev/null +++ b/tests/drivers/i2c/i2c_target_api/boards/frdm_mcxe247.overlay @@ -0,0 +1,31 @@ +/* + * Copyright 2025 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* To test this sample, connect + * LPI2C0 SCL(J2-20) --> LPI2C3 SCL(J5-5) + * LPI2C0 SDA(J2-18) --> LPI2C3 SDA(J5-6) + */ + +&lpi2c0 { + eeprom0: eeprom@54 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x54>; + size = <256>; + }; +}; + +&lpi2c1 { + eeprom1: eeprom@56 { + compatible = "zephyr,i2c-target-eeprom"; + reg = <0x56>; + size = <256>; + }; +}; + +/* Disable the FXLS8974 sensor to avoid conflict with accel samples */ +&fxls8974 { + status = "disabled"; +};