boards: arm: Enable arduino serial port on mimxrt685_evk
Configures flexcomm4 to operate in USART mode and enables the associated
peripheral clock and pinmuxes. This instance is attached to the Arduino
serial header pins and can be used for Bluetooth serial HCI with a
frdm_kw41z or other BLE controller shield.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
diff --git a/boards/arm/mimxrt685_evk/doc/index.rst b/boards/arm/mimxrt685_evk/doc/index.rst
index 1af5285..675edb9 100644
--- a/boards/arm/mimxrt685_evk/doc/index.rst
+++ b/boards/arm/mimxrt685_evk/doc/index.rst
@@ -127,6 +127,10 @@
+---------+-----------------+----------------------------+
| PIO0_21 | I2S | I2S TX SCK |
+---------+-----------------+----------------------------+
+| PIO0_29 | USART | USART TX |
++---------+-----------------+----------------------------+
+| PIO0_30 | USART | USART RX |
++---------+-----------------+----------------------------+
| PIO0_9 | I2S | I2S DATAIN |
+---------+-----------------+----------------------------+
| PIO1_11 | FLEXSPI0B_DATA0 | OctalSPI Flash |
diff --git a/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts b/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts
index cb469b9..ff731ee 100644
--- a/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts
+++ b/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.dts
@@ -139,6 +139,11 @@
};
};
+arduino_serial: &flexcomm4 {
+ compatible = "nxp,lpc-usart";
+ current-speed = <115200>;
+};
+
arduino_spi: &flexcomm5 {
compatible = "nxp,lpc-spi";
status = "okay";
diff --git a/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.yaml b/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.yaml
index 871b9d7..6629c9b 100644
--- a/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.yaml
+++ b/boards/arm/mimxrt685_evk/mimxrt685_evk_cm33.yaml
@@ -17,6 +17,7 @@
supported:
- arduino_gpio
- arduino_i2c
+ - arduino_serial
- arduino_spi
- counter
- dma
diff --git a/boards/arm/mimxrt685_evk/pinmux.c b/boards/arm/mimxrt685_evk/pinmux.c
index 79373d2..620ba60 100644
--- a/boards/arm/mimxrt685_evk/pinmux.c
+++ b/boards/arm/mimxrt685_evk/pinmux.c
@@ -192,6 +192,51 @@
IOPCTL_PinMuxSet(IOPCTL, 1U, 5U, port1_pin5_config);
#endif
+#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_usart, okay) && CONFIG_SERIAL
+ /* USART4 RX, TX */
+ uint32_t port0_pin29_config = (/* Pin is configured as FC4_TXD_SCL_MISO_WS */
+ IOPCTL_PIO_FUNC1 |
+ /* Disable pull-up / pull-down function */
+ IOPCTL_PIO_PUPD_DI |
+ /* Enable pull-down function */
+ IOPCTL_PIO_PULLDOWN_EN |
+ /* Disable input buffer function */
+ IOPCTL_PIO_INBUF_DI |
+ /* Normal mode */
+ IOPCTL_PIO_SLEW_RATE_NORMAL |
+ /* Normal drive */
+ IOPCTL_PIO_FULLDRIVE_DI |
+ /* Analog mux is disabled */
+ IOPCTL_PIO_ANAMUX_DI |
+ /* Pseudo Output Drain is disabled */
+ IOPCTL_PIO_PSEDRAIN_DI |
+ /* Input function is not inverted */
+ IOPCTL_PIO_INV_DI);
+ /* PORT0 PIN1 (coords: G2) is configured as FC4_TXD_SCL_MISO_WS */
+ IOPCTL_PinMuxSet(IOPCTL, 0U, 29U, port0_pin29_config);
+
+ uint32_t port0_pin30_config = (/* Pin is configured as FC4_RXD_SDA_MOSI_DATA */
+ IOPCTL_PIO_FUNC1 |
+ /* Disable pull-up / pull-down function */
+ IOPCTL_PIO_PUPD_DI |
+ /* Enable pull-down function */
+ IOPCTL_PIO_PULLDOWN_EN |
+ /* Enables input buffer function */
+ IOPCTL_PIO_INBUF_EN |
+ /* Normal mode */
+ IOPCTL_PIO_SLEW_RATE_NORMAL |
+ /* Normal drive */
+ IOPCTL_PIO_FULLDRIVE_DI |
+ /* Analog mux is disabled */
+ IOPCTL_PIO_ANAMUX_DI |
+ /* Pseudo Output Drain is disabled */
+ IOPCTL_PIO_PSEDRAIN_DI |
+ /* Input function is not inverted */
+ IOPCTL_PIO_INV_DI);
+ /* PORT0 PIN2 (coords: G4) is configured as FC4_RXD_SDA_MOSI_DATA */
+ IOPCTL_PinMuxSet(IOPCTL, 0U, 30U, port0_pin30_config);
+#endif
+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(flexcomm5), okay) && CONFIG_SPI
uint32_t port1_pin3_config = (/* Pin is configured as FC5_SCK */
IOPCTL_PIO_FUNC1 |
diff --git a/soc/arm/nxp_imx/rt6xx/soc.c b/soc/arm/nxp_imx/rt6xx/soc.c
index ad60c2a..4b7c23c 100644
--- a/soc/arm/nxp_imx/rt6xx/soc.c
+++ b/soc/arm/nxp_imx/rt6xx/soc.c
@@ -155,6 +155,10 @@
CLOCK_AttachClk(kSFRO_to_FLEXCOMM2);
#endif
+#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_usart, okay)
+ CLOCK_AttachClk(kSFRO_to_FLEXCOMM4);
+#endif
+
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm5), nxp_lpc_spi, okay)
CLOCK_AttachClk(kFFRO_to_FLEXCOMM5);
#endif