File tree Expand file tree Collapse file tree 6 files changed +40
-1
lines changed
boards/arm/mimxrt1020_evk
samples/drivers/adc/boards
tests/drivers/adc/adc_api/src Expand file tree Collapse file tree 6 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,8 @@ features:
90
90
+-----------+------------+-------------------------------------+
91
91
| USB | on-chip | USB device |
92
92
+-----------+------------+-------------------------------------+
93
+ | ADC | on-chip | adc |
94
+ +-----------+------------+-------------------------------------+
93
95
94
96
The default configuration can be found in the defconfig file:
95
97
``boards/arm/mimxrt1020_evk/mimxrt1020_evk_defconfig ``
@@ -164,6 +166,10 @@ The MIMXRT1020 SoC has five pairs of pinmux/gpio controllers.
164
166
+---------------+-----------------+---------------------------+
165
167
| GPIO_SD_B0_06 | USDHC1_CD_B | SD Card |
166
168
+---------------+-----------------+---------------------------+
169
+ | GPIO_AD_B1_10 | ADC | ADC1 Channel 10 |
170
+ +---------------+-----------------+---------------------------+
171
+ | GPIO_AD_B1_11 | ADC | ADC1 Channel 11 |
172
+ +---------------+-----------------+---------------------------+
167
173
168
174
System Clock
169
175
============
Original file line number Diff line number Diff line change @@ -158,3 +158,7 @@ zephyr_udc0: &usb1 {
158
158
cd-gpios = <&gpio1 23 GPIO_ACTIVE_LOW>;
159
159
no-1-8-v;
160
160
};
161
+
162
+ &adc1 {
163
+ status = "okay";
164
+ };
Original file line number Diff line number Diff line change @@ -23,3 +23,4 @@ supported:
23
23
- netif:eth
24
24
- spi
25
25
- usb_device
26
+ - adc
Original file line number Diff line number Diff line change @@ -262,6 +262,21 @@ static int mimxrt1020_evk_init(const struct device *dev)
262
262
imxrt_usdhc_pinmux_cb_register (mimxrt1020_evk_usdhc_pinmux );
263
263
#endif
264
264
265
+ #if DT_NODE_HAS_STATUS (DT_NODELABEL (adc1 ), okay ) && CONFIG_ADC
266
+ /* ADC1 Channel 10 and 11 are on pins 1 and 2 of J18 */
267
+ /* ADC1 Channel 10 */
268
+ IOMUXC_SetPinMux (IOMUXC_GPIO_AD_B1_10_GPIO1_IO26 , 0U );
269
+ /* ADC1 Channel 11 */
270
+ IOMUXC_SetPinMux (IOMUXC_GPIO_AD_B1_11_GPIO1_IO27 , 0U );
271
+
272
+ IOMUXC_SetPinConfig (IOMUXC_GPIO_AD_B1_10_GPIO1_IO26 ,
273
+ IOMUXC_SW_PAD_CTL_PAD_SPEED (2 ) |
274
+ IOMUXC_SW_PAD_CTL_PAD_DSE (6 ));
275
+ IOMUXC_SetPinConfig (IOMUXC_GPIO_AD_B1_11_GPIO1_IO27 ,
276
+ IOMUXC_SW_PAD_CTL_PAD_SPEED (2 ) |
277
+ IOMUXC_SW_PAD_CTL_PAD_DSE (6 ));
278
+ #endif
279
+
265
280
return 0 ;
266
281
}
267
282
Original file line number Diff line number Diff line change
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 10>;
11
+ };
12
+ };
Original file line number Diff line number Diff line change 301
301
defined(CONFIG_BOARD_MIMXRT1060_EVK ) || \
302
302
defined(CONFIG_BOARD_MIMXRT1024_EVK ) || \
303
303
defined(CONFIG_BOARD_MIMXRT1010_EVK ) || \
304
- defined(CONFIG_BOARD_MIMXRT1015_EVK )
304
+ defined(CONFIG_BOARD_MIMXRT1015_EVK ) || \
305
+ defined(CONFIG_BOARD_MIMXRT1020_EVK )
305
306
#define ADC_DEVICE_NAME DT_LABEL(DT_INST(0, nxp_mcux_12b1msps_sar))
306
307
#define ADC_RESOLUTION 12
307
308
#define ADC_GAIN ADC_GAIN_1
You can’t perform that action at this time.
0 commit comments