boards: mimxrt1010_evk: Added ADC support to RT1010

Added ADC support to RT1010 evaluation board. ADC channels 1 and 2 are
exposed as pins 10 and 12 of J26.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
Daniel DeGrasse 2021-10-11 17:03:00 -05:00 committed by Carles Cufí
commit 4e6ac9324b
6 changed files with 38 additions and 1 deletions

View file

@ -76,6 +76,8 @@ features:
+-----------+------------+-------------------------------------+
| USB | on-chip | USB device |
+-----------+------------+-------------------------------------+
| ADC | on-chip | adc |
+-----------+------------+-------------------------------------+
The default configuration can be found in the defconfig file:
``boards/arm/mimxrt1010_evk/mimxrt1010_evk_defconfig``
@ -110,6 +112,10 @@ The MIMXRT1010 SoC has five pairs of pinmux/gpio controllers.
+---------------+-----------------+---------------------------+
| GPIO_AD_06 | LPSPI1_SCK | SPI |
+---------------+-----------------+---------------------------+
| GPIO_AD_01 | ADC | ADC1 Channel 1 |
+---------------+-----------------+---------------------------+
| GPIO_AD_02 | ADC | ADC1 Channel 2 |
+---------------+-----------------+---------------------------+
System Clock
============

View file

@ -72,3 +72,7 @@ arduino_serial: &lpuart1 {};
zephyr_udc0: &usb1 {
status = "okay";
};
&adc1 {
status = "okay";
};

View file

@ -20,3 +20,4 @@ supported:
- counter
- usb_device
- spi
- adc

View file

@ -101,6 +101,19 @@ static int mimxrt1010_evk_init(const struct device *dev)
IOMUXC_SW_PAD_CTL_PAD_DSE(4));
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
/* ADC Channels 1 and 2, exposed as pins 10 and 12 on J26 of EVK */
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_01_GPIOMUX_IO15, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_02_GPIOMUX_IO16, 0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_01_GPIOMUX_IO15,
IOMUXC_SW_PAD_CTL_PAD_SPEED(2) |
IOMUXC_SW_PAD_CTL_PAD_DSE(4));
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_02_GPIOMUX_IO16,
IOMUXC_SW_PAD_CTL_PAD_SPEED(2) |
IOMUXC_SW_PAD_CTL_PAD_DSE(4));
#endif
return 0;
}

View file

@ -0,0 +1,12 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2021 NXP
*/
/ {
zephyr,user {
/* adjust channel number according to pinmux in board.dts */
io-channels = <&adc1 1>;
};
};

View file

@ -299,7 +299,8 @@
defined(CONFIG_BOARD_MIMXRT1050_EVK_QSPI) || \
defined(CONFIG_BOARD_MIMXRT1064_EVK) || \
defined(CONFIG_BOARD_MIMXRT1060_EVK) || \
defined(CONFIG_BOARD_MIMXRT1024_EVK)
defined(CONFIG_BOARD_MIMXRT1024_EVK) || \
defined(CONFIG_BOARD_MIMXRT1010_EVK)
#define ADC_DEVICE_NAME DT_LABEL(DT_INST(0, nxp_mcux_12b1msps_sar))
#define ADC_RESOLUTION 12
#define ADC_GAIN ADC_GAIN_1