Skip to content

Commit ea8eea4

Browse files
ZhaoxiangJindleach02
authored andcommitted
boards: nxp/frdm_mcxn947: Support LPCMP for NXP frdm_mcxn947 board
Support LPCMP for NXP frdm_mcxn947 board Signed-off-by: Zhaoxiang Jin <[email protected]>
1 parent c4cba91 commit ea8eea4

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

boards/nxp/frdm_mcxn947/board.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ static int frdm_mcxn947_init(void)
268268
USB_EhciPhyInit(kUSB_ControllerEhci0, BOARD_XTAL0_CLK_HZ, &usbPhyConfig);
269269
#endif
270270

271+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpcmp0), okay)
272+
CLOCK_SetClkDiv(kCLOCK_DivCmp0FClk, 1U);
273+
CLOCK_AttachClk(kFRO12M_to_CMP0F);
274+
SPC_EnableActiveModeAnalogModules(SPC0, (kSPC_controlCmp0 | kSPC_controlCmp0Dac));
275+
#endif
276+
271277
/* Set SystemCoreClock variable. */
272278
SystemCoreClock = CLOCK_INIT_CORE_CLOCK;
273279

boards/nxp/frdm_mcxn947/doc/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ The FRDM-MCXN947 board configuration supports the following hardware features:
9090
+-----------+------------+-------------------------------------+
9191
| USBHS | on-chip | USB device |
9292
+-----------+------------+-------------------------------------+
93+
| LPCMP | on-chip | sensor(comparator) |
94+
+-----------+------------+-------------------------------------+
9395

9496
Targets available
9597
==================

boards/nxp/frdm_mcxn947/frdm_mcxn947-pinctrl.dtsi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,13 @@
157157
drive-strength = "low";
158158
};
159159
};
160+
161+
pinmux_lpcmp0: pinmux_lpcmp0 {
162+
group0 {
163+
pinmux = <CMP0_IN0_PIO1_0>;
164+
drive-strength = "low";
165+
slew-rate = "fast";
166+
bias-pull-up;
167+
};
168+
};
160169
};

boards/nxp/frdm_mcxn947/frdm_mcxn947.dtsi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,8 @@
191191
pinctrl-0 = <&pinmux_lpadc0>;
192192
pinctrl-names = "default";
193193
};
194+
195+
&lpcmp0 {
196+
pinctrl-0 = <&pinmux_lpcmp0>;
197+
pinctrl-names = "default";
198+
};

boards/nxp/frdm_mcxn947/frdm_mcxn947_mcxn947_cpu0.dts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,7 @@
165165
zephyr_udc0: &usb1 {
166166
status = "okay";
167167
};
168+
169+
&lpcmp0 {
170+
status = "okay";
171+
};

0 commit comments

Comments
 (0)