Skip to content
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

Add mcxc444 adc support #81040

Open
wants to merge 3 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
2 changes: 2 additions & 0 deletions boards/nxp/frdm_mcxc444/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ The ``frdm_mcxc444`` board target supports the following hardware features:
+-----------+------------+-------------------------------------+
| FLASH | on-chip | soc flash |
+-----------+------------+-------------------------------------+
| ADC | on-chip | adc |
+-----------+------------+-------------------------------------+


Targets available
Expand Down
8 changes: 8 additions & 0 deletions boards/nxp/frdm_mcxc444/frdm_mcxc444-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@
slew-rate = "slow";
};
};
pinmux_adc0: pinmux_adc0 {
group0 {
pinmux = <ADC0_SE0_PTE20>,
<ADC0_SE3_PTE22>;
drive-strength = "low";
slew-rate = "slow";
};
};
};
6 changes: 6 additions & 0 deletions boards/nxp/frdm_mcxc444/frdm_mcxc444.dts
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,9 @@
pinctrl-0 = <&pinmux_lpuart0>;
pinctrl-names = "default";
};

&adc0 {
status = "okay";
pinctrl-0 = <&pinmux_adc0>;
pinctrl-names = "default";
};
1 change: 1 addition & 0 deletions boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ toolchain:
- xtools
supported:
- gpio
- adc
testing:
ignore_tags:
- net
Expand Down
1 change: 1 addition & 0 deletions samples/drivers/adc/adc_dt/boards/frdm_mcxc444.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ADC_MCUX_ADC16_VREF_ALTERNATE=y
31 changes: 31 additions & 0 deletions samples/drivers/adc/adc_dt/boards/frdm_mcxc444.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 NXP
*/

/ {
zephyr,user {
/* adjust channel number according to pinmux in board.dts */
io-channels = <&adc0 0>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;

/*
* To use this sample:
* - Connect ADC0 SE0 signal to voltage between 0~3.3V (J4 pin 1)
*/

channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_VDD_1";
zephyr,vref-mv = <3300>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
1 change: 1 addition & 0 deletions samples/drivers/adc/adc_dt/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ tests:
- rd_rw612_bga
- frdm_mcxn947/mcxn947/cpu0
- frdm_mcxc242
- frdm_mcxc444
- ucans32k1sic
integration_platforms:
- nucleo_l073rz
Expand Down
1 change: 1 addition & 0 deletions samples/drivers/adc/adc_sequence/boards/frdm_mcxc444.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ADC_MCUX_ADC16_VREF_ALTERNATE=y
30 changes: 30 additions & 0 deletions samples/drivers/adc/adc_sequence/boards/frdm_mcxc444.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 NXP
*/

/ {
aliases {
adc0 = &adc0;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;

/*
* To use this sample:
* - Connect ADC0 SE0 signal to voltage between 0~3.3V (J4 pin 1)
*/

channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_VDD_1";
zephyr,vref-mv = <3300>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
1 change: 1 addition & 0 deletions samples/drivers/adc/adc_sequence/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tests:
- nrf54h20dk/nrf54h20/cpuapp
- ucans32k1sic
- frdm_mcxc242
- frdm_mcxc242
integration_platforms:
- nrf52840dk/nrf52840
harness: console
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ADC_MCUX_ADC16_VREF_ALTERNATE=y
29 changes: 29 additions & 0 deletions tests/drivers/adc/adc_accuracy_test/boards/frdm_mcxc444.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 NXP
*/

/* Please connect voltage reference to J4 pin 1 to run the test. */

/ {
zephyr,user {
io-channels = <&adc0 0>;
reference_mv = <1650>;
expected_accuracy = <32>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;

channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_VDD_1";
zephyr,vref-mv = <3300>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
1 change: 1 addition & 0 deletions tests/drivers/adc/adc_accuracy_test/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ tests:
- frdm_kl25z
- ek_ra8m1
- frdm_mcxc242
- frdm_mcxc444
- nrf52840dk/nrf52840
- nrf54l15dk/nrf54l15/cpuapp
- nrf54h20dk/nrf54h20/cpuapp
1 change: 1 addition & 0 deletions tests/drivers/adc/adc_api/boards/frdm_mcxc444.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ADC_MCUX_ADC16_VREF_ALTERNATE=y
34 changes: 34 additions & 0 deletions tests/drivers/adc/adc_api/boards/frdm_mcxc444.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2024 NXP
*/

/ {
zephyr,user {
io-channels = <&adc0 0>, <&adc0 3>;
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;

channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_VDD_1";
zephyr,vref-mv = <3300>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};

channel@3 {
reg = <3>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_VDD_1";
zephyr,vref-mv = <3300>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
};
};
Loading