Skip to content

Commit c8cbc97

Browse files
committed
feat(esp8266): Add configuration for UART swap I/O pins
1 parent 57e11f6 commit c8cbc97

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

components/bootloader_support/src/bootloader_init.c

+10
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,16 @@ static void update_flash_config(const esp_image_header_t* pfhdr);
568568

569569
static void uart_console_configure(void)
570570
{
571+
#if CONFIG_CONSOLE_UART_SWAP_IO
572+
while (READ_PERI_REG(UART_STATUS(0)) & (UART_TXFIFO_CNT << UART_TXFIFO_CNT_S));
573+
574+
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_UART0_CTS);
575+
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_UART0_RTS);
576+
577+
// UART0: TXD <-> RTS and RXD <-> CTS
578+
SET_PERI_REG_MASK(UART_SWAP_REG, 0x4);
579+
#endif
580+
571581
#if CONFIG_CONSOLE_UART_NUM == 1
572582
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK);
573583

components/esp8266/Kconfig

+6
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ config CONSOLE_UART_BAUDRATE
5757
default 74880
5858
range 1200 4000000
5959

60+
config CONSOLE_UART_SWAP_IO
61+
bool "Swap UART0 I/O pins"
62+
default n
63+
help
64+
Enable this option, UART0's I/O pins are swaped: TXD <-> RTS, RTX <-> CTS.
65+
6066
endmenu
6167

6268
menu WIFI

0 commit comments

Comments
 (0)