Skip to content

Commit 4e6ac93

Browse files
danieldegrassecarlescufi
authored andcommitted
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 <[email protected]>
1 parent b0d613d commit 4e6ac93

File tree

6 files changed

+38
-1
lines changed

6 files changed

+38
-1
lines changed

boards/arm/mimxrt1010_evk/doc/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ features:
7676
+-----------+------------+-------------------------------------+
7777
| USB | on-chip | USB device |
7878
+-----------+------------+-------------------------------------+
79+
| ADC | on-chip | adc |
80+
+-----------+------------+-------------------------------------+
7981

8082
The default configuration can be found in the defconfig file:
8183
``boards/arm/mimxrt1010_evk/mimxrt1010_evk_defconfig``
@@ -110,6 +112,10 @@ The MIMXRT1010 SoC has five pairs of pinmux/gpio controllers.
110112
+---------------+-----------------+---------------------------+
111113
| GPIO_AD_06 | LPSPI1_SCK | SPI |
112114
+---------------+-----------------+---------------------------+
115+
| GPIO_AD_01 | ADC | ADC1 Channel 1 |
116+
+---------------+-----------------+---------------------------+
117+
| GPIO_AD_02 | ADC | ADC1 Channel 2 |
118+
+---------------+-----------------+---------------------------+
113119

114120
System Clock
115121
============

boards/arm/mimxrt1010_evk/mimxrt1010_evk.dts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@ arduino_serial: &lpuart1 {};
7272
zephyr_udc0: &usb1 {
7373
status = "okay";
7474
};
75+
76+
&adc1 {
77+
status = "okay";
78+
};

boards/arm/mimxrt1010_evk/mimxrt1010_evk.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ supported:
2020
- counter
2121
- usb_device
2222
- spi
23+
- adc

boards/arm/mimxrt1010_evk/pinmux.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,19 @@ static int mimxrt1010_evk_init(const struct device *dev)
101101
IOMUXC_SW_PAD_CTL_PAD_DSE(4));
102102
#endif
103103

104+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
105+
/* ADC Channels 1 and 2, exposed as pins 10 and 12 on J26 of EVK */
106+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_01_GPIOMUX_IO15, 0U);
107+
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_02_GPIOMUX_IO16, 0U);
108+
109+
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_01_GPIOMUX_IO15,
110+
IOMUXC_SW_PAD_CTL_PAD_SPEED(2) |
111+
IOMUXC_SW_PAD_CTL_PAD_DSE(4));
112+
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_02_GPIOMUX_IO16,
113+
IOMUXC_SW_PAD_CTL_PAD_SPEED(2) |
114+
IOMUXC_SW_PAD_CTL_PAD_DSE(4));
115+
#endif
116+
104117
return 0;
105118
}
106119

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* Copyright (c) 2021 NXP
5+
*/
6+
7+
/ {
8+
zephyr,user {
9+
/* adjust channel number according to pinmux in board.dts */
10+
io-channels = <&adc1 1>;
11+
};
12+
};

tests/drivers/adc/adc_api/src/test_adc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@
299299
defined(CONFIG_BOARD_MIMXRT1050_EVK_QSPI) || \
300300
defined(CONFIG_BOARD_MIMXRT1064_EVK) || \
301301
defined(CONFIG_BOARD_MIMXRT1060_EVK) || \
302-
defined(CONFIG_BOARD_MIMXRT1024_EVK)
302+
defined(CONFIG_BOARD_MIMXRT1024_EVK) || \
303+
defined(CONFIG_BOARD_MIMXRT1010_EVK)
303304
#define ADC_DEVICE_NAME DT_LABEL(DT_INST(0, nxp_mcux_12b1msps_sar))
304305
#define ADC_RESOLUTION 12
305306
#define ADC_GAIN ADC_GAIN_1

0 commit comments

Comments
 (0)