Skip to content

Commit c5dd2c2

Browse files
lucien-nxpcarlescufi
authored andcommitted
samples: sensor: mcux_acmp: add case support for RT1180-EVK
Use gpio_ad_01_acmp1_in2 as ACMP1_IN2, test case can be captured in J45-13. Signed-off-by: Lucien Zhao <[email protected]>
1 parent 62e5805 commit c5dd2c2

File tree

6 files changed

+71
-3
lines changed

6 files changed

+71
-3
lines changed

boards/nxp/mimxrt1180_evk/doc/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ configuration supports the following hardware features:
107107
+-----------+------------+-------------------------------------+
108108
| I2C | on-chip | i2c |
109109
+-----------+------------+-------------------------------------+
110+
| ACMP | on-chip | analog comparator |
111+
+-----------+------------+-------------------------------------+
110112

111113
The default configuration can be found in the defconfig file:
112114
:zephyr_file:`boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33_defconfig`

samples/sensor/mcux_acmp/README.rst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ Overview
99

1010
This sample show how to use the NXP MCUX Analog Comparator (ACMP) driver. The
1111
sample supports the :ref:`twr_ke18f`, :ref:`mimxrt1170_evk`, :ref:`frdm_ke17z`
12-
and :ref:`frdm_ke17z512`.
12+
, :ref:`frdm_ke17z512` and :ref:`mimxrt1180_evk`.
1313

1414
The input voltage for the negative input of the analog comparator is
1515
provided by the ACMP Digital-to-Analog Converter (DAC). The input voltage for
1616
the positive input can be adjusted by turning the on-board potentiometer for
1717
:ref:`twr_ke18f` board, for :ref:`mimxrt1170_evk` the voltage signal is
1818
captured on J25-13, the :ref:`frdm_ke17z` and :ref:`frdm_ke17z512` boards are
19-
captured in J2-3, need change the external voltage signal to check the output.
19+
captured in J2-3, the :ref:`mimxrt1180_evk` board are captured in J45-13, need
20+
change the external voltage signal to check the output.
2021

2122
The output value of the analog comparator is reported on the console.
2223

@@ -66,3 +67,20 @@ ACMP input voltage by changing the voltage input to J2-3.
6667
:board: frdm_ke17z512
6768
:goals: flash
6869
:compact:
70+
71+
Building and Running for MIMXRT1180-EVK
72+
=======================================
73+
Build the application for the MIMXRT1180-EVK board, and adjust the
74+
ACMP input voltage by changing the voltage input to J45-13.
75+
76+
.. zephyr-app-commands::
77+
:zephyr-app: samples/sensor/mcux_acmp
78+
:board: mimxrt1180_evk/mimxrt1189/cm33
79+
:goals: flash
80+
:compact:
81+
82+
.. zephyr-app-commands::
83+
:zephyr-app: samples/sensor/mcux_acmp
84+
:board: mimxrt1180_evk/mimxrt1189/cm7
85+
:goals: flash
86+
:compact:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&pinctrl {
8+
acmp1_default: acmp1_default {
9+
group0 {
10+
pinmux = <&iomuxc_gpio_ad_01_acmp1_in2>;
11+
drive-strength = "high";
12+
bias-pull-up;
13+
slew-rate = "fast";
14+
};
15+
};
16+
};
17+
18+
&acmp1 {
19+
status = "okay";
20+
pinctrl-0 = <&acmp1_default>;
21+
pinctrl-names = "default";
22+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&pinctrl {
8+
acmp1_default: acmp1_default {
9+
group0 {
10+
pinmux = <&iomuxc_gpio_ad_01_acmp1_in2>;
11+
drive-strength = "high";
12+
bias-pull-up;
13+
slew-rate = "fast";
14+
};
15+
};
16+
};
17+
18+
&acmp1 {
19+
status = "okay";
20+
pinctrl-0 = <&acmp1_default>;
21+
pinctrl-names = "default";
22+
};

samples/sensor/mcux_acmp/sample.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ common:
88
- mimxrt1170_evk/mimxrt1176/cm4
99
- frdm_ke17z
1010
- frdm_ke17z512
11+
- mimxrt1180_evk/mimxrt1189/cm33
12+
- mimxrt1180_evk/mimxrt1189/cm7
1113
integration_platforms:
1214
- twr_ke18f
1315
tags:

samples/sensor/mcux_acmp/src/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define ACMP_POSITIVE 5
1717
#define ACMP_NEGATIVE 5
1818
#define ACMP_DAC_VREF 0
19-
#elif defined(CONFIG_BOARD_MIMXRT1170_EVK)
19+
#elif (defined(CONFIG_BOARD_MIMXRT1170_EVK) || defined(CONFIG_BOARD_MIMXRT1180_EVK))
2020
#define ACMP_NODE DT_NODELABEL(acmp1)
2121
#define ACMP_POSITIVE 2
2222
#define ACMP_NEGATIVE 7
@@ -58,8 +58,10 @@ static const struct acmp_attr attrs[] = {
5858
.val = ACMP_DAC_VREF },
5959
/* DAC value */
6060
{ .attr = SENSOR_ATTR_MCUX_ACMP_DAC_VALUE, .val = ACMP_DAC_VALUE },
61+
#if MCUX_ACMP_HAS_HYSTCTR
6162
/* Hysteresis level */
6263
{ .attr = SENSOR_ATTR_MCUX_ACMP_HYSTERESIS_LEVEL, .val = 3 },
64+
#endif
6365
#if MCUX_ACMP_HAS_DISCRETE_MODE
6466
/* Discrete mode */
6567
{ .attr = SENSOR_ATTR_MCUX_ACMP_POSITIVE_DISCRETE_MODE, .val = 1 },

0 commit comments

Comments
 (0)