Skip to content

Commit f642681

Browse files
nordic-krchtejlmand
authored andcommitted
[nrf fromlist] drivers: serial: nrfx: Add pullups to RXD and CTS
Configured UART/UARTE input pins to have pullups. Otherwise when uart is disconnected pins are floating and generate receiver errors. Upstream PR: zephyrproject-rtos/zephyr#36366 Signed-off-by: Krzysztof Chruscinski <[email protected]> Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 02f76ba commit f642681

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

drivers/serial/uart_nrfx_uart.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ static int uart_nrfx_init(const struct device *dev)
995995
nrf_gpio_cfg_output(TX_PIN);
996996

997997
if (RX_PIN_USED) {
998-
nrf_gpio_cfg_input(RX_PIN, NRF_GPIO_PIN_NOPULL);
998+
nrf_gpio_cfg_input(RX_PIN, NRF_GPIO_PIN_PULLUP);
999999
}
10001000

10011001
nrf_uart_txrx_pins_set(uart0_addr, TX_PIN, RX_PIN);
@@ -1009,7 +1009,7 @@ static int uart_nrfx_init(const struct device *dev)
10091009
}
10101010

10111011
if (HAS_PROP(cts_pin)) {
1012-
nrf_gpio_cfg_input(CTS_PIN, NRF_GPIO_PIN_NOPULL);
1012+
nrf_gpio_cfg_input(CTS_PIN, NRF_GPIO_PIN_PULLUP);
10131013
}
10141014

10151015
nrf_uart_hwfc_pins_set(uart0_addr, RTS_PIN, CTS_PIN);
@@ -1110,16 +1110,15 @@ static void uart_nrfx_pins_enable(const struct device *dev, bool enable)
11101110
nrf_gpio_pin_write(tx_pin, 1);
11111111
nrf_gpio_cfg_output(tx_pin);
11121112
if (RX_PIN_USED) {
1113-
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_NOPULL);
1113+
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_PULLUP);
11141114
}
11151115

11161116
if (HAS_PROP(rts_pin)) {
11171117
nrf_gpio_pin_write(rts_pin, 1);
11181118
nrf_gpio_cfg_output(rts_pin);
11191119
}
11201120
if (HAS_PROP(cts_pin)) {
1121-
nrf_gpio_cfg_input(cts_pin,
1122-
NRF_GPIO_PIN_NOPULL);
1121+
nrf_gpio_cfg_input(cts_pin, NRF_GPIO_PIN_PULLUP);
11231122
}
11241123
} else {
11251124
nrf_gpio_cfg_default(tx_pin);

drivers/serial/uart_nrfx_uarte.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,13 +1660,13 @@ static int uarte_instance_init(const struct device *dev,
16601660
nrf_gpio_cfg_output(config->pseltxd);
16611661

16621662
if (config->pselrxd != NRF_UARTE_PSEL_DISCONNECTED) {
1663-
nrf_gpio_cfg_input(config->pselrxd, NRF_GPIO_PIN_NOPULL);
1663+
nrf_gpio_cfg_input(config->pselrxd, NRF_GPIO_PIN_PULLUP);
16641664
}
16651665

16661666
nrf_uarte_txrx_pins_set(uarte, config->pseltxd, config->pselrxd);
16671667

16681668
if (config->pselcts != NRF_UARTE_PSEL_DISCONNECTED) {
1669-
nrf_gpio_cfg_input(config->pselcts, NRF_GPIO_PIN_NOPULL);
1669+
nrf_gpio_cfg_input(config->pselcts, NRF_GPIO_PIN_PULLUP);
16701670
}
16711671

16721672
if (config->pselrts != NRF_UARTE_PSEL_DISCONNECTED) {
@@ -1753,7 +1753,7 @@ static void uarte_nrfx_pins_enable(const struct device *dev, bool enable)
17531753
nrf_gpio_pin_write(tx_pin, 1);
17541754
nrf_gpio_cfg_output(tx_pin);
17551755
if (rx_pin != NRF_UARTE_PSEL_DISCONNECTED) {
1756-
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_NOPULL);
1756+
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_PULLUP);
17571757
}
17581758

17591759
if (IS_RTS_PIN_SET(get_dev_config(dev)->flags)) {
@@ -1763,7 +1763,7 @@ static void uarte_nrfx_pins_enable(const struct device *dev, bool enable)
17631763

17641764
if (IS_CTS_PIN_SET(get_dev_config(dev)->flags)) {
17651765
nrf_gpio_cfg_input(cts_pin,
1766-
NRF_GPIO_PIN_NOPULL);
1766+
NRF_GPIO_PIN_PULLUP);
17671767
}
17681768
} else {
17691769
nrf_gpio_cfg_default(tx_pin);

0 commit comments

Comments
 (0)