samples: sensor/mcux_acmp: Support ACMP case on mimxrt700_evk
1. Supported ACMP case on mimxrt700_evk 2. Fixed the issue of using the same address for different trigger sources. This bug would cause the examples to run in a way that did not match the theory. 3. Removed some redundant descriptions in the README.rst. Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
This commit is contained in:
parent
4ebbdd5151
commit
dfd2240bd4
@ -9,17 +9,11 @@ Overview
|
||||
|
||||
This sample show how to use the NXP MCUX Analog Comparator (ACMP) driver. The
|
||||
sample supports the :zephyr:board:`twr_ke18f`, :zephyr:board:`mimxrt1170_evk`, :zephyr:board:`frdm_ke17z`
|
||||
, :zephyr:board:`frdm_ke17z512` and :zephyr:board:`mimxrt1180_evk`.
|
||||
, :zephyr:board:`frdm_ke17z512`, :zephyr:board:`mimxrt1180_evk` and :zephyr:board:`mimxrt700_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
|
||||
:zephyr:board:`twr_ke18f` board, for :zephyr:board:`mimxrt1170_evk` the voltage signal is
|
||||
captured on J25-13, the :zephyr:board:`frdm_ke17z` and :zephyr:board:`frdm_ke17z512` boards are
|
||||
captured in J2-3, the :zephyr:board:`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.
|
||||
provided by the ACMP Digital-to-Analog Converter (DAC). The output value
|
||||
of the analog comparator is reported on the console.
|
||||
|
||||
Building and Running
|
||||
********************
|
||||
@ -84,3 +78,22 @@ ACMP input voltage by changing the voltage input to J45-13.
|
||||
:board: mimxrt1180_evk/mimxrt1189/cm7
|
||||
:goals: flash
|
||||
:compact:
|
||||
|
||||
Building and Running for MIMXRT700-EVK
|
||||
=======================================
|
||||
Build the application for the MIMXRT700-EVK board, and adjust the
|
||||
ACMP input voltage by changing the voltage input to J7-9.
|
||||
|
||||
Note:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/sensor/mcux_acmp
|
||||
:board: mimxrt700_evk/mimxrt798s/cm33_cpu0
|
||||
:goals: flash
|
||||
:compact:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/sensor/mcux_acmp
|
||||
:board: mimxrt700_evk/mimxrt798s/cm33_cpu1
|
||||
:goals: flash
|
||||
:compact:
|
||||
|
||||
@ -10,6 +10,8 @@ common:
|
||||
- mimxrt1170_evk/mimxrt1176/cm4
|
||||
- mimxrt1180_evk/mimxrt1189/cm33
|
||||
- mimxrt1180_evk/mimxrt1189/cm7
|
||||
- mimxrt700_evk/mimxrt798s/cm33_cpu0
|
||||
- mimxrt700_evk/mimxrt798s/cm33_cpu1
|
||||
integration_platforms:
|
||||
- twr_ke18f
|
||||
tags:
|
||||
|
||||
@ -27,6 +27,11 @@
|
||||
#define ACMP_POSITIVE 4
|
||||
#define ACMP_NEGATIVE 4
|
||||
#define ACMP_DAC_VREF 0
|
||||
#elif (defined(CONFIG_BOARD_MIMXRT700_EVK))
|
||||
#define ACMP_NODE DT_NODELABEL(acmp)
|
||||
#define ACMP_POSITIVE 1
|
||||
#define ACMP_NEGATIVE 7
|
||||
#define ACMP_DAC_VREF 1
|
||||
#else
|
||||
#error Unsupported board
|
||||
#endif
|
||||
@ -97,7 +102,16 @@ static void acmp_trigger_handler(const struct device *dev,
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct sensor_trigger trigger;
|
||||
struct sensor_trigger trigger[ARRAY_SIZE(triggers)] = {
|
||||
[0] = {
|
||||
.chan = SENSOR_CHAN_MCUX_ACMP_OUTPUT,
|
||||
.type = triggers[0],
|
||||
},
|
||||
[1] = {
|
||||
.chan = SENSOR_CHAN_MCUX_ACMP_OUTPUT,
|
||||
.type = triggers[1],
|
||||
}};
|
||||
|
||||
const struct device *const acmp = DEVICE_DT_GET(ACMP_NODE);
|
||||
struct sensor_value val;
|
||||
int err;
|
||||
@ -124,10 +138,8 @@ int main(void)
|
||||
k_sleep(K_MSEC(1));
|
||||
|
||||
/* Set ACMP triggers */
|
||||
trigger.chan = SENSOR_CHAN_MCUX_ACMP_OUTPUT;
|
||||
for (i = 0; i < ARRAY_SIZE(triggers); i++) {
|
||||
trigger.type = triggers[i];
|
||||
err = sensor_trigger_set(acmp, &trigger, acmp_trigger_handler);
|
||||
err = sensor_trigger_set(acmp, &trigger[i], acmp_trigger_handler);
|
||||
if (err) {
|
||||
printf("failed to set trigger %d (err %d)", i, err);
|
||||
return 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user