Skip to content

enable dac on rt1180 #94314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33.dts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 NXP
* Copyright 2024-2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -42,6 +42,10 @@
status = "okay";
};

&dac {
status = "okay";
};

&systick {
status = "okay";
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2024 NXP
# Copyright 2024-2025 NXP
#
# SPDX-License-Identifier: Apache-2.0
#
Expand Down Expand Up @@ -30,4 +30,5 @@ supported:
- watchdog
- usbd
- sdhc
- dac
vendor: nxp
4 changes: 4 additions & 0 deletions boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.dts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
status = "okay";
};

&dac {
status = "okay";
};

&systick {
status = "okay";
};
Expand Down
3 changes: 2 additions & 1 deletion boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm7.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2024 NXP
# Copyright 2024-2025 NXP
#
# SPDX-License-Identifier: Apache-2.0
#
Expand Down Expand Up @@ -27,4 +27,5 @@ supported:
- sdhc
- spi
- uart
- dac
vendor: nxp
9 changes: 9 additions & 0 deletions dts/arm/nxp/nxp_rt118x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,15 @@
clocks = <&ccm IMX_CCM_LPADC2_CLK 0 0>;
};

dac: dac@42e20000 {
compatible = "nxp,dac12";
reg = <0x42e20000 0x1000>;
interrupts = <193 0>;
voltage-reference = <2>;
status = "disabled";
#io-channel-cells = <1>;
};

qtmr1: qtmr@2690000 {
compatible = "nxp,imx-qtmr";
reg = <0x2690000 0x4000>;
Expand Down
19 changes: 19 additions & 0 deletions samples/drivers/dac/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,25 @@ follows:

DAC output is available on connector J12 pin 4.

Building and Running for MIMXRT1180-EVK
=======================================
The sample can be built and executed for the :zephyr:board:`mimxrt1180_evk` as
follows:

.. zephyr-app-commands::
:zephyr-app: samples/drivers/dac
:board: mimxrt1180_evk/mimxrt1189/cm33
:goals: flash
:compact:

.. zephyr-app-commands::
:zephyr-app: samples/drivers/dac
:board: mimxrt1180_evk/mimxrt1189/cm7
:goals: flash
:compact:

Connect J10 pin 1-2., the DAC output is available on TP9.

Sample output
=============

Expand Down
13 changes: 13 additions & 0 deletions samples/drivers/dac/boards/mimxrt1180_evk_mimxrt1189_cm33.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
zephyr,user {
dac = <&dac>;
dac-channel-id = <0>;
dac-resolution = <12>;
};
};
13 changes: 13 additions & 0 deletions samples/drivers/dac/boards/mimxrt1180_evk_mimxrt1189_cm7.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
zephyr,user {
dac = <&dac>;
dac-channel-id = <0>;
dac-resolution = <12>;
};
};
39 changes: 13 additions & 26 deletions tests/drivers/dac/dac_api/src/test_dac.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
#define DAC_CHANNEL_ID 2
#define DAC_RESOLUTION 12

/* Note external DAC MCP4725 is not populated on BL652_DVK, BL653_DVK and
* BL654_DVK at factory
*/
#elif defined(CONFIG_BOARD_TWR_KE18F) || \
defined(CONFIG_BOARD_FRDM_K64F) || \
defined(CONFIG_BOARD_FRDM_K22F) || \
Expand All @@ -56,19 +59,13 @@
defined(CONFIG_BOARD_ARDUINO_MKRZERO) || \
defined(CONFIG_BOARD_ARDUINO_ZERO) || \
defined(CONFIG_BOARD_LPCXPRESSO55S36) || \
defined(CONFIG_BOARD_SAME54_XPRO)

#define DAC_DEVICE_NODE DT_NODELABEL(dac0)
#define DAC_RESOLUTION 12
#define DAC_CHANNEL_ID 0

#elif defined(CONFIG_BOARD_BL652_DVK) || \
defined(CONFIG_BOARD_SAME54_XPRO) || \
defined(CONFIG_BOARD_BL652_DVK) || \
defined(CONFIG_BOARD_BL653_DVK) || \
defined(CONFIG_BOARD_BL654_DVK) || \
defined(CONFIG_BOARD_BL5340_DVK)
/* Note external DAC MCP4725 is not populated on BL652_DVK, BL653_DVK and
* BL654_DVK at factory
*/
defined(CONFIG_BOARD_BL5340_DVK) || \
DT_HAS_COMPAT_STATUS_OKAY(renesas_ra_dac)

#define DAC_DEVICE_NODE DT_NODELABEL(dac0)
#define DAC_RESOLUTION 12
#define DAC_CHANNEL_ID 0
Expand All @@ -82,7 +79,9 @@
defined(CONFIG_BOARD_GD32F450I_EVAL) || \
defined(CONFIG_BOARD_GD32F450Z_EVAL) || \
defined(CONFIG_BOARD_GD32F470I_EVAL) || \
defined(CONFIG_BOARD_YD_ESP32)
defined(CONFIG_BOARD_YD_ESP32) || \
defined(CONFIG_BOARD_MIMXRT1170_EVK) || \
defined(CONFIG_BOARD_MIMXRT1180_EVK)

#define DAC_DEVICE_NODE DT_NODELABEL(dac)
#define DAC_RESOLUTION 12
Expand All @@ -102,23 +101,11 @@
#define DAC_RESOLUTION 10
#define DAC_CHANNEL_ID 0

#elif DT_HAS_COMPAT_STATUS_OKAY(renesas_ra_dac)

#define DAC_DEVICE_NODE DT_NODELABEL(dac0)
#define DAC_RESOLUTION 12
#define DAC_CHANNEL_ID 0

#elif defined(CONFIG_BOARD_MIMXRT1170_EVK)

#define DAC_DEVICE_NODE DT_NODELABEL(dac)
#define DAC_RESOLUTION 12
#define DAC_CHANNEL_ID 0

#elif defined(CONFIG_SOC_FAMILY_SILABS_S2)

#define DAC_DEVICE_NODE DT_NODELABEL(vdac0)
#define DAC_RESOLUTION 12
#define DAC_CHANNEL_ID 0
#define DAC_RESOLUTION 12
#define DAC_CHANNEL_ID 0

#else
#error "Unsupported board."
Expand Down
Loading