Commit 77f8848f authored by Daniel DeGrasse's avatar Daniel DeGrasse Committed by David Leach
Browse files

boards: arm: mimxrt1040_evk: enable ADC support

Enable ADC support for RT1040 EVK. Tested using samples/drivers/adc,
using channels 3 and 4 of ADC0.

Signed-off-by: default avatarDaniel DeGrasse <daniel.degrasse@nxp.com>
parent 0d046666
Loading
Loading
Loading
Loading
+6 −0
Changes for boards/arm/mimxrt1040_evk/doc/index.rst: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -93,6 +93,8 @@ already supported, which can also be re-used on this mimxrt1040_evk board:
+-----------+------------+-------------------------------------+
| PWM       | on-chip    | pwm                                 |
+-----------+------------+-------------------------------------+
| ADC       | on-chip    | adc                                 |
+-----------+------------+-------------------------------------+

The default configuration can be found in the defconfig file:

@@ -118,6 +120,10 @@ The MIMXRT1040 SoC has five pairs of pinmux/gpio controllers.
+---------------+-----------------+---------------------------+
| GPIO_AD_B0_10 | FLEXPWM1 PWM3A  | PWM Output                |
+---------------+-----------------+---------------------------+
| GPIO_AD_B0_14 | ADC0 IN3        | ADC0 Input                |
+---------------+-----------------+---------------------------+
| GPIO_AD_B0_15 | ADC0 IN4        | ADC0 Input                |
+---------------+-----------------+---------------------------+

System Clock
============
+11 −0
Changes for boards/arm/mimxrt1040_evk/mimxrt1040_evk-pinctrl.dtsi: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,17 @@
#include <nxp/nxp_imx/rt/mimxrt1042xjm5b-pinctrl.dtsi>

&pinctrl {
	/* Route ADC1 IN3 and IN4 to J33 pins 1 and 2 */
	pinmux_adc1: pinmux_adc1 {
		group0 {
			pinmux = <&iomuxc_gpio_ad_b0_14_adc1_in3>,
				<&iomuxc_gpio_ad_b0_15_adc1_in4>;
			drive-strength = "r0-6";
			slew-rate = "slow";
			nxp,speed = "100-mhz";
		};
	};

	/* Route PWM1 A3 to J16, pin 6 on arduino header */
	pinmux_flexpwm1_pwm3: pinmux_flexpwm1_pwm3 {
		group0 {
+6 −0
Changes for boards/arm/mimxrt1040_evk/mimxrt1040_evk.dts: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -110,6 +110,12 @@
	pinctrl-names = "default";
};

&adc1 {
	status = "okay";
	pinctrl-0 = <&pinmux_adc1>;
	pinctrl-names = "default";
};

/* GPT and Systick are enabled. If power management is enabled, the GPT
 * timer will be used instead of systick, as allows the core clock to
 * be gated.
+1 −0
Changes for boards/arm/mimxrt1040_evk/mimxrt1040_evk.yaml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -18,3 +18,4 @@ supported:
  - arduino_gpio
  - gpio
  - pwm
  - adc
+37 −0
Changes for samples/drivers/adc/boards/mimxrt1040_evk.overlay: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * Copyright 2023 NXP
 */

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

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

	/*
	 * To use this sample connect
	 * J33.1 (ADC1 CH3) and J33.2 (ADC1 CH4) to voltages between 0 and 3.3V
	 */
	channel@3 {
		reg = <3>;
		zephyr,gain = "ADC_GAIN_1";
		zephyr,reference = "ADC_REF_INTERNAL";
		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
		zephyr,resolution = <12>;
	};

	channel@4 {
		reg = <4>;
		zephyr,gain = "ADC_GAIN_1";
		zephyr,reference = "ADC_REF_INTERNAL";
		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
		zephyr,resolution = <12>;
	};
};
Loading