My project needs fast hardware UART (921600 baud, no bit banging), I2C, SPI and some other GPIOs. Since I2C1 and UART1 both occupy P4 and P5, I’ve been studying the schematic and datasheet and found that LPUART2 is unused and maps to P6 and SD_CD. I can cut the SD_CD connection at the SD Card holder and tap into GPIO_AD_B1_02 there. Claude suggests these changes in the firmware to setup these pins as uart(2).
Set MICROPY_HW_UART_INDEX { 3, 1, 2 }, so LPUART2 becomes UART(2)
Fill the LPUART2 slot in IOMUX_TABLE_UART (the { 0 }, { 0 } pair after LPUART1) with { IOMUXC_GPIO_AD_B1_02_LPUART2_TX }, { IOMUXC_GPIO_AD_B1_03_LPUART2_RX }.
Add the pad to pins.csv (UART2_TX,GPIO_AD_B1_02). AD_B1_03 is already P6.
Clear the P6 GPIO claim for AD_B1_03 (P6_GPIO in pins_config.h).
In micropython use UART(2, baudrate=...)
My first question is will this work and second is there anything else I need to do to run uart 2 on P6 and SD_CD.
Hi, uh… I can’t say if it would work or not. Like, the GPIO pins and uarts on the MCU can be configured to do whatever you like if you edit the firmware and re-route the pins.
However, maybe it would be wise to use like a bridge chip instead? There are I2C to uart bridges or SPI to uart bridges. We use one of these for the FLIR Boson adapter and it works great. You can use software I2C to talk to these chips over any GPIO pair.
I was hoping that with your immense knowledge and experience with the OMV firmware on the RT1062, and naively thinking that the setup of LPUART2 would mirror the configurations of LPUART1 on P4/P5, that you could provide us with a version of the firmware, or the lines to insert/change, to facilitate an additional UART.
@ajacobs - Let’s jump on a call and talk about what you are trying to do… when folks start talking about modifying internal traces on the board, it’s usually not the right way to go. There are other options.