From bbec164673128436367a7fe791cf64ffc6833836 Mon Sep 17 00:00:00 2001 From: Neil Chen Date: Fri, 29 Nov 2024 14:49:59 +0800 Subject: [PATCH] boards: nxp: frdm_mcxa156: Support dac for NXP frdm_mcxa156 board Support dac for NXP frdm_mcxa156 board. Signed-off-by: Neil Chen --- boards/nxp/frdm_mcxa156/board.c | 8 ++++++++ boards/nxp/frdm_mcxa156/doc/index.rst | 2 ++ boards/nxp/frdm_mcxa156/frdm_mcxa156-pinctrl.dtsi | 8 +++++++- boards/nxp/frdm_mcxa156/frdm_mcxa156.dts | 6 ++++++ boards/nxp/frdm_mcxa156/frdm_mcxa156.yaml | 1 + 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/boards/nxp/frdm_mcxa156/board.c b/boards/nxp/frdm_mcxa156/board.c index 84347c4715c..26e42979ed8 100644 --- a/boards/nxp/frdm_mcxa156/board.c +++ b/boards/nxp/frdm_mcxa156/board.c @@ -116,6 +116,14 @@ static int frdm_mcxa156_init(void) CLOCK_AttachClk(kFRO12M_to_LPUART0); #endif +#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac0)) + SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac0); + CLOCK_SetClockDiv(kCLOCK_DivDAC0, 1u); + CLOCK_AttachClk(kFRO12M_to_DAC0); + + CLOCK_EnableClock(kCLOCK_GateDAC0); +#endif + /* Set SystemCoreClock variable. */ SystemCoreClock = CLOCK_INIT_CORE_CLOCK; diff --git a/boards/nxp/frdm_mcxa156/doc/index.rst b/boards/nxp/frdm_mcxa156/doc/index.rst index 6af4aec4f4e..4094a7904a4 100644 --- a/boards/nxp/frdm_mcxa156/doc/index.rst +++ b/boards/nxp/frdm_mcxa156/doc/index.rst @@ -54,6 +54,8 @@ The FRDM-MCXA156 board configuration supports the following hardware features: +-----------+------------+-------------------------------------+ | FLASH | on-chip | soc flash | +-----------+------------+-------------------------------------+ +| DAC | on-chip | dac | ++-----------+------------+-------------------------------------+ Targets available ================== diff --git a/boards/nxp/frdm_mcxa156/frdm_mcxa156-pinctrl.dtsi b/boards/nxp/frdm_mcxa156/frdm_mcxa156-pinctrl.dtsi index 70b51d0ac8e..d99fc81ddb4 100644 --- a/boards/nxp/frdm_mcxa156/frdm_mcxa156-pinctrl.dtsi +++ b/boards/nxp/frdm_mcxa156/frdm_mcxa156-pinctrl.dtsi @@ -16,5 +16,11 @@ input-enable; }; }; - + pinmux_dac0: pinmux_dac0 { + group0 { + pinmux = ; + drive-strength = "low"; + slew-rate = "fast"; + }; + }; }; diff --git a/boards/nxp/frdm_mcxa156/frdm_mcxa156.dts b/boards/nxp/frdm_mcxa156/frdm_mcxa156.dts index 73c872a0337..10b1a9e7dc8 100644 --- a/boards/nxp/frdm_mcxa156/frdm_mcxa156.dts +++ b/boards/nxp/frdm_mcxa156/frdm_mcxa156.dts @@ -88,3 +88,9 @@ pinctrl-0 = <&pinmux_lpuart0>; pinctrl-names = "default"; }; + +&dac0 { + status = "okay"; + pinctrl-0 = <&pinmux_dac0>; + pinctrl-names = "default"; +}; diff --git a/boards/nxp/frdm_mcxa156/frdm_mcxa156.yaml b/boards/nxp/frdm_mcxa156/frdm_mcxa156.yaml index c7809e4548b..93ad8719223 100644 --- a/boards/nxp/frdm_mcxa156/frdm_mcxa156.yaml +++ b/boards/nxp/frdm_mcxa156/frdm_mcxa156.yaml @@ -16,4 +16,5 @@ toolchain: - xtools supported: - gpio + - dac vendor: nxp