boards: add adc support to the mimxrt1050 board
add adc to board dts file, update yaml files and documentation, add adc 1 channel pins 1 and 15 to the pinmux file, add overlay file to the board adc sample, add board to the adc test file and Signed-off-by: Andrei Auchynnikau <ovchinnikov@strim-tech.com>
This commit is contained in:
parent
baf913b9df
commit
822f2c3cb4
7 changed files with 41 additions and 0 deletions
|
@ -116,6 +116,8 @@ features:
|
||||||
+-----------+------------+-------------------------------------+
|
+-----------+------------+-------------------------------------+
|
||||||
| USB | on-chip | USB device |
|
| USB | on-chip | USB device |
|
||||||
+-----------+------------+-------------------------------------+
|
+-----------+------------+-------------------------------------+
|
||||||
|
| ADC | on-chip | adc |
|
||||||
|
+-----------+------------+-------------------------------------+
|
||||||
|
|
||||||
The default configuration can be found in the defconfig file:
|
The default configuration can be found in the defconfig file:
|
||||||
|
|
||||||
|
@ -159,6 +161,8 @@ The MIMXRT1050 SoC has five pairs of pinmux/gpio controllers.
|
||||||
+---------------+-----------------+---------------------------+
|
+---------------+-----------------+---------------------------+
|
||||||
| GPIO_AD_B1_07 | LPUART3_RX | UART BT HCI |
|
| GPIO_AD_B1_07 | LPUART3_RX | UART BT HCI |
|
||||||
+---------------+-----------------+---------------------------+
|
+---------------+-----------------+---------------------------+
|
||||||
|
| GPIO_AD_B1_11 | ADC | ADC1 channel 0 |
|
||||||
|
+---------------+-----------------+---------------------------+
|
||||||
| WAKEUP | GPIO | SW0 |
|
| WAKEUP | GPIO | SW0 |
|
||||||
+---------------+-----------------+---------------------------+
|
+---------------+-----------------+---------------------------+
|
||||||
| GPIO_B0_00 | LCD_CLK | LCD Display |
|
| GPIO_B0_00 | LCD_CLK | LCD Display |
|
||||||
|
|
|
@ -93,6 +93,10 @@
|
||||||
|
|
||||||
arduino_serial: &lpuart3 {};
|
arduino_serial: &lpuart3 {};
|
||||||
|
|
||||||
|
&adc1 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
&flexspi {
|
&flexspi {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
ahb-prefetch;
|
ahb-prefetch;
|
||||||
|
|
|
@ -27,3 +27,4 @@ supported:
|
||||||
- usb_device
|
- usb_device
|
||||||
- kscan:touch
|
- kscan:touch
|
||||||
- watchdog
|
- watchdog
|
||||||
|
- adc
|
||||||
|
|
|
@ -26,3 +26,4 @@ supported:
|
||||||
- spi
|
- spi
|
||||||
- usb_device
|
- usb_device
|
||||||
- watchdog
|
- watchdog
|
||||||
|
- adc
|
||||||
|
|
|
@ -377,6 +377,15 @@ static int mimxrt1050_evk_init(const struct device *dev)
|
||||||
imxrt_usdhc_pinmux_cb_register(mimxrt1050_evk_usdhc_pinmux);
|
imxrt_usdhc_pinmux_cb_register(mimxrt1050_evk_usdhc_pinmux);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc1), okay) && CONFIG_ADC
|
||||||
|
/* ADC1 Input 0 */
|
||||||
|
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_11_GPIO1_IO27, 0U);
|
||||||
|
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_11_GPIO1_IO27, 0xB0u);
|
||||||
|
/* ADC1 Input 15 */
|
||||||
|
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_10_GPIO1_IO26, 0U);
|
||||||
|
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_10_GPIO1_IO26, 0xB0u);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
samples/drivers/adc/boards/mimxrt1050_evk.overlay
Normal file
12
samples/drivers/adc/boards/mimxrt1050_evk.overlay
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 Linaro Limited
|
||||||
|
*/
|
||||||
|
|
||||||
|
/ {
|
||||||
|
zephyr,user {
|
||||||
|
/* adjust channel number according to pinmux in board.dts */
|
||||||
|
io-channels = <&adc1 0>;
|
||||||
|
};
|
||||||
|
};
|
|
@ -295,6 +295,16 @@
|
||||||
#define ADC_1ST_CHANNEL_ID 0
|
#define ADC_1ST_CHANNEL_ID 0
|
||||||
#define ADC_2ND_CHANNEL_ID 1
|
#define ADC_2ND_CHANNEL_ID 1
|
||||||
|
|
||||||
|
#elif defined(CONFIG_BOARD_MIMXRT1050_EVK) || \
|
||||||
|
defined(CONFIG_BOARD_MIMXRT1050_EVK_QSPI)
|
||||||
|
#define ADC_DEVICE_NAME DT_LABEL(DT_INST(0, nxp_mcux_12b1msps_sar))
|
||||||
|
#define ADC_RESOLUTION 12
|
||||||
|
#define ADC_GAIN ADC_GAIN_1
|
||||||
|
#define ADC_REFERENCE ADC_REF_INTERNAL
|
||||||
|
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
|
||||||
|
#define ADC_1ST_CHANNEL_ID 0
|
||||||
|
#define ADC_2ND_CHANNEL_ID 1
|
||||||
|
|
||||||
#elif defined(CONFIG_BOARD_NATIVE_POSIX)
|
#elif defined(CONFIG_BOARD_NATIVE_POSIX)
|
||||||
#define ADC_DEVICE_NAME DT_LABEL(DT_INST(0, zephyr_adc_emul))
|
#define ADC_DEVICE_NAME DT_LABEL(DT_INST(0, zephyr_adc_emul))
|
||||||
#define ADC_RESOLUTION 10
|
#define ADC_RESOLUTION 10
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue