Skip to content

Commit

Permalink
boards: nxp: frdm_mcxw71: Enable MCXW71 I2C Loopback
Browse files Browse the repository at this point in the history
Enable and test I2C loopback with i2c_target_api

Signed-off-by: Emilio Benavente <[email protected]>
  • Loading branch information
EmilioCBen committed Jan 10, 2025
1 parent 8998b1a commit dcaec92
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
10 changes: 10 additions & 0 deletions boards/nxp/frdm_mcxw71/frdm_mcxw71-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
};
};

pinmux_lpi2c0: pinmux_lpi2c0 {
group0 {
pinmux = <LPI2C0_SCL_PTA19>,
<LPI2C0_SDA_PTA18>;
drive-strength = "low";
slew-rate = "fast";
drive-open-drain;
};
};

pinmux_lpi2c1: pinmux_lpi2c1 {
group0 {
pinmux = <LPI2C1_SCL_PTB5>,
Expand Down
4 changes: 4 additions & 0 deletions soc/nxp/mcx/mcxw/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ static ALWAYS_INLINE void clock_init(void)
CLOCK_EnableClock(kCLOCK_PortA);
}

if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(gpiob), nxp_kinetis_gpio, okay)) {
CLOCK_EnableClock(kCLOCK_PortB);
}

if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(gpioc), nxp_kinetis_gpio, okay)) {
CLOCK_EnableClock(kCLOCK_PortC);
}
Expand Down
1 change: 1 addition & 0 deletions tests/drivers/i2c/i2c_target_api/boards/frdm_mcxw71.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_I2C_VIRTUAL=n
37 changes: 37 additions & 0 deletions tests/drivers/i2c/i2c_target_api/boards/frdm_mcxw71.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

/*
* This is a looback setup for the frdm_mcxw71
* To test this sample, connect J2.1 <-> J1.5 and J2.2 <-> J2.9
*/
&lpi2c1 {
status = "okay";
eeprom0: eeprom@54 {
compatible = "zephyr,i2c-target-eeprom";
reg = <0x54>;
size = <256>;
};
};

&lpi2c0 {
status = "okay";
pinctrl-0 = <&pinmux_lpi2c0>;
pinctrl-names = "default";
eeprom1: eeprom@56 {
compatible = "zephyr,i2c-target-eeprom";
reg = <0x56>;
size = <256>;
};
};

&gpiob {
status = "okay";
};

&gpioa {
status = "okay";
};

0 comments on commit dcaec92

Please sign in to comment.