boards: mimxrt1015_evk: Enable ADC on RT1015

Enables ADC on RT1015 evaluation board. Channels 1 and 13 are exposed as
pins 2 and 1 of J18 on the EVK.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
Daniel DeGrasse 2021-10-11 17:24:03 -05:00 committed by Carles Cufí
commit ac174d3075
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/mimxrt1015_evk/mimxrt1015_evk_defconfig``
@ -114,6 +116,10 @@ The MIMXRT1015 SoC has five pairs of pinmux/gpio controllers.
+---------------+-----------------+---------------------------+
| GPIO_AD_B0_13 | LPSPI1_SDI | SPI |
+---------------+-----------------+---------------------------+
| GPIO_AD_B0_14 | ADC | ADC1 Channel 1 |
+---------------+-----------------+---------------------------+
| GPIO_AD_B1_13 | ADC | ADC1 Channel 13 |
+---------------+-----------------+---------------------------+
System Clock
============

View file

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

View file

@ -22,3 +22,4 @@ supported:
- i2c
- usb_device
- spi
- adc

View file

@ -106,6 +106,19 @@ static int mimxrt1015_evk_init(const struct device *dev)
IOMUXC_SW_PAD_CTL_PAD_DSE(6));
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) & CONFIG_ADC
/* ADC1 Channels 1 and 13 exposed as pins 2 and 1 on J18 of eval board */
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_14_GPIO1_IO14, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_13_GPIO1_IO29, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_14_GPIO1_IO14,
IOMUXC_SW_PAD_CTL_PAD_SPEED(2) |
IOMUXC_SW_PAD_CTL_PAD_DSE(6));
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_13_GPIO1_IO29,
IOMUXC_SW_PAD_CTL_PAD_SPEED(2) |
IOMUXC_SW_PAD_CTL_PAD_DSE(6));
#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 13>;
};
};

View file

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