boards: arm: Enable arduino serial port on lpcxpresso55s69

Configures flexcomm2 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>
This commit is contained in:
Maureen Helm 2021-05-17 16:35:47 -05:00 committed by Kumar Gala
commit d83bbc2f25
5 changed files with 38 additions and 0 deletions

View file

@ -113,6 +113,8 @@ functionality of a pin.
+=========+=================+============================+
| PIO0_26 | SPI | SPI MOSI |
+---------+-----------------+----------------------------+
| PIO0_27 | USART | USART TX |
+---------+-----------------+----------------------------+
| PIO0_29 | USART | USART RX |
+---------+-----------------+----------------------------+
| PIO0_30 | USART | USART TX |
@ -133,6 +135,8 @@ functionality of a pin.
+---------+-----------------+----------------------------+
| PIO1_21 | I2C | I2C SDA |
+---------+-----------------+----------------------------+
| PIO1_24 | USART | USART RX |
+---------+-----------------+----------------------------+
Memory mappings
===============

View file

@ -163,6 +163,11 @@ arduino_i2c: &flexcomm4 {
};
};
arduino_serial: &flexcomm2 {
compatible = "nxp,lpc-usart";
current-speed = <115200>;
};
arduino_spi: &hs_lspi {
};

View file

@ -17,6 +17,7 @@ toolchain:
supported:
- adc
- arduino_i2c
- arduino_serial
- arduino_spi
- gpio
- i2c

View file

@ -53,6 +53,30 @@ static int lpcxpresso_55s69_pinmux_init(const struct device *dev)
#endif
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm2), nxp_lpc_usart, okay) && CONFIG_SERIAL
/* USART2 RX, TX */
uint32_t port1_pin24_config = (
IOCON_PIO_FUNC1 |
IOCON_PIO_MODE_INACT |
IOCON_PIO_INV_DI |
IOCON_PIO_DIGITAL_EN |
IOCON_PIO_SLEW_STANDARD |
IOCON_PIO_OPENDRAIN_DI
);
uint32_t port0_pin27_config = (
IOCON_PIO_FUNC1 |
IOCON_PIO_MODE_INACT |
IOCON_PIO_INV_DI |
IOCON_PIO_DIGITAL_EN |
IOCON_PIO_SLEW_STANDARD |
IOCON_PIO_OPENDRAIN_DI
);
pinmux_pin_set(port1, 24, port1_pin24_config);
pinmux_pin_set(port0, 27, port0_pin27_config);
#endif
#if DT_PHA_HAS_CELL(DT_ALIAS(sw0), gpios, pin)
uint32_t sw0_config = (
IOCON_PIO_FUNC0 |

View file

@ -64,6 +64,10 @@ static ALWAYS_INLINE void clock_init(void)
/* Enables the clock for the I/O controller.: Enable Clock. */
CLOCK_EnableClock(kCLOCK_Iocon);
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm2), nxp_lpc_usart, okay)
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM2);
#endif
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm4), nxp_lpc_i2c, okay)
/* attach 12 MHz clock to FLEXCOMM4 */
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4);