From 0ffe2f0006fd9f2040900a44d97e0a67ab8ff9b7 Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Sat, 12 Oct 2024 11:03:40 +0800 Subject: [PATCH] boards: nxp/frdm_mcxn236: Support lpadc for NXP frdm_mcxn236 Support lpadc for NXP frdm_mcxn236 Signed-off-by: Neil Chen --- boards/nxp/frdm_mcxn236/board.c | 5 +++++ boards/nxp/frdm_mcxn236/doc/index.rst | 2 ++ boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi | 10 ++++++++++ boards/nxp/frdm_mcxn236/frdm_mcxn236.dts | 4 ++++ boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi | 5 +++++ boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml | 1 + 6 files changed, 27 insertions(+) diff --git a/boards/nxp/frdm_mcxn236/board.c b/boards/nxp/frdm_mcxn236/board.c index 88b01760a50..a8bf784f561 100644 --- a/boards/nxp/frdm_mcxn236/board.c +++ b/boards/nxp/frdm_mcxn236/board.c @@ -175,6 +175,11 @@ static int frdm_mcxn236_init(void) SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlVref); #endif +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(lpadc0)) + CLOCK_SetClkDiv(kCLOCK_DivAdc0Clk, 1U); + CLOCK_AttachClk(kFRO_HF_to_ADC0); +#endif + /* Set SystemCoreClock variable. */ SystemCoreClock = CLOCK_INIT_CORE_CLOCK; diff --git a/boards/nxp/frdm_mcxn236/doc/index.rst b/boards/nxp/frdm_mcxn236/doc/index.rst index 766a2d9ec42..864b7d04584 100644 --- a/boards/nxp/frdm_mcxn236/doc/index.rst +++ b/boards/nxp/frdm_mcxn236/doc/index.rst @@ -70,6 +70,8 @@ The FRDM-MCXN236 board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | VREF | on-chip | regulator | +-----------+------------+-------------------------------------+ +| ADC | on-chip | adc | ++-----------+------------+-------------------------------------+ Targets available ================== diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi b/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi index 7e587aad528..bc2b1084910 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236-pinctrl.dtsi @@ -90,4 +90,14 @@ }; }; + + pinmux_lpadc0: pinmux_lpadc0 { + group0 { + pinmux = , + , + ; + slew-rate = "fast"; + drive-strength = "low"; + }; + }; }; diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts index 3f14683e8f2..e1b3397acf9 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dts @@ -117,3 +117,7 @@ &vref { status = "okay"; }; + +&lpadc0 { + status = "okay"; +}; diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi index b4631c79afa..9464d7b26a9 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236.dtsi @@ -118,3 +118,8 @@ pinctrl-0 = <&pinmux_flexpwm1_pwm0>; pinctrl-names = "default"; }; + +&lpadc0 { + pinctrl-0 = <&pinmux_lpadc0>; + pinctrl-names = "default"; +}; diff --git a/boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml b/boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml index b1c8f18a591..d01d9a447b5 100644 --- a/boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml +++ b/boards/nxp/frdm_mcxn236/frdm_mcxn236.yaml @@ -23,4 +23,5 @@ supported: - pwm - counter - regulator + - adc vendor: nxp