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 <lucien.zhao@nxp.com>
This commit is contained in:
Lucien Zhao 2024-08-31 14:37:17 +08:00 committed by Carles Cufí
commit c5dd2c2a84
6 changed files with 71 additions and 3 deletions

View file

@ -107,6 +107,8 @@ configuration supports the following hardware features:
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| ACMP | on-chip | analog comparator |
+-----------+------------+-------------------------------------+
The default configuration can be found in the defconfig file:
:zephyr_file:`boards/nxp/mimxrt1180_evk/mimxrt1180_evk_mimxrt1189_cm33_defconfig`

View file

@ -9,14 +9,15 @@ Overview
This sample show how to use the NXP MCUX Analog Comparator (ACMP) driver. The
sample supports the :ref:`twr_ke18f`, :ref:`mimxrt1170_evk`, :ref:`frdm_ke17z`
and :ref:`frdm_ke17z512`.
, :ref:`frdm_ke17z512` and :ref:`mimxrt1180_evk`.
The input voltage for the negative input of the analog comparator is
provided by the ACMP Digital-to-Analog Converter (DAC). The input voltage for
the positive input can be adjusted by turning the on-board potentiometer for
:ref:`twr_ke18f` board, for :ref:`mimxrt1170_evk` the voltage signal is
captured on J25-13, the :ref:`frdm_ke17z` and :ref:`frdm_ke17z512` boards are
captured in J2-3, need change the external voltage signal to check the output.
captured in J2-3, the :ref:`mimxrt1180_evk` board are captured in J45-13, need
change the external voltage signal to check the output.
The output value of the analog comparator is reported on the console.
@ -66,3 +67,20 @@ ACMP input voltage by changing the voltage input to J2-3.
:board: frdm_ke17z512
:goals: flash
:compact:
Building and Running for MIMXRT1180-EVK
=======================================
Build the application for the MIMXRT1180-EVK board, and adjust the
ACMP input voltage by changing the voltage input to J45-13.
.. zephyr-app-commands::
:zephyr-app: samples/sensor/mcux_acmp
:board: mimxrt1180_evk/mimxrt1189/cm33
:goals: flash
:compact:
.. zephyr-app-commands::
:zephyr-app: samples/sensor/mcux_acmp
:board: mimxrt1180_evk/mimxrt1189/cm7
:goals: flash
:compact:

View file

@ -0,0 +1,22 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
&pinctrl {
acmp1_default: acmp1_default {
group0 {
pinmux = <&iomuxc_gpio_ad_01_acmp1_in2>;
drive-strength = "high";
bias-pull-up;
slew-rate = "fast";
};
};
};
&acmp1 {
status = "okay";
pinctrl-0 = <&acmp1_default>;
pinctrl-names = "default";
};

View file

@ -0,0 +1,22 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
&pinctrl {
acmp1_default: acmp1_default {
group0 {
pinmux = <&iomuxc_gpio_ad_01_acmp1_in2>;
drive-strength = "high";
bias-pull-up;
slew-rate = "fast";
};
};
};
&acmp1 {
status = "okay";
pinctrl-0 = <&acmp1_default>;
pinctrl-names = "default";
};

View file

@ -8,6 +8,8 @@ common:
- mimxrt1170_evk/mimxrt1176/cm4
- frdm_ke17z
- frdm_ke17z512
- mimxrt1180_evk/mimxrt1189/cm33
- mimxrt1180_evk/mimxrt1189/cm7
integration_platforms:
- twr_ke18f
tags:

View file

@ -16,7 +16,7 @@
#define ACMP_POSITIVE 5
#define ACMP_NEGATIVE 5
#define ACMP_DAC_VREF 0
#elif defined(CONFIG_BOARD_MIMXRT1170_EVK)
#elif (defined(CONFIG_BOARD_MIMXRT1170_EVK) || defined(CONFIG_BOARD_MIMXRT1180_EVK))
#define ACMP_NODE DT_NODELABEL(acmp1)
#define ACMP_POSITIVE 2
#define ACMP_NEGATIVE 7
@ -58,8 +58,10 @@ static const struct acmp_attr attrs[] = {
.val = ACMP_DAC_VREF },
/* DAC value */
{ .attr = SENSOR_ATTR_MCUX_ACMP_DAC_VALUE, .val = ACMP_DAC_VALUE },
#if MCUX_ACMP_HAS_HYSTCTR
/* Hysteresis level */
{ .attr = SENSOR_ATTR_MCUX_ACMP_HYSTERESIS_LEVEL, .val = 3 },
#endif
#if MCUX_ACMP_HAS_DISCRETE_MODE
/* Discrete mode */
{ .attr = SENSOR_ATTR_MCUX_ACMP_POSITIVE_DISCRETE_MODE, .val = 1 },