Skip to content

Commit 3656ba5

Browse files
nordic-krchioannisg
authored andcommitted
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. Signed-off-by: Krzysztof Chruscinski <[email protected]> Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent d37fa54 commit 3656ba5

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
@@ -996,7 +996,7 @@ static int uart_nrfx_init(const struct device *dev)
996996
nrf_gpio_cfg_output(TX_PIN);
997997

998998
if (RX_PIN_USED) {
999-
nrf_gpio_cfg_input(RX_PIN, NRF_GPIO_PIN_NOPULL);
999+
nrf_gpio_cfg_input(RX_PIN, NRF_GPIO_PIN_PULLUP);
10001000
}
10011001

10021002
nrf_uart_txrx_pins_set(uart0_addr, TX_PIN, RX_PIN);
@@ -1010,7 +1010,7 @@ static int uart_nrfx_init(const struct device *dev)
10101010
}
10111011

10121012
if (HAS_PROP(cts_pin)) {
1013-
nrf_gpio_cfg_input(CTS_PIN, NRF_GPIO_PIN_NOPULL);
1013+
nrf_gpio_cfg_input(CTS_PIN, NRF_GPIO_PIN_PULLUP);
10141014
}
10151015

10161016
nrf_uart_hwfc_pins_set(uart0_addr, RTS_PIN, CTS_PIN);
@@ -1113,16 +1113,15 @@ static void uart_nrfx_pins_enable(const struct device *dev, bool enable)
11131113
nrf_gpio_pin_write(tx_pin, 1);
11141114
nrf_gpio_cfg_output(tx_pin);
11151115
if (RX_PIN_USED) {
1116-
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_NOPULL);
1116+
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_PULLUP);
11171117
}
11181118

11191119
if (HAS_PROP(rts_pin)) {
11201120
nrf_gpio_pin_write(rts_pin, 1);
11211121
nrf_gpio_cfg_output(rts_pin);
11221122
}
11231123
if (HAS_PROP(cts_pin)) {
1124-
nrf_gpio_cfg_input(cts_pin,
1125-
NRF_GPIO_PIN_NOPULL);
1124+
nrf_gpio_cfg_input(cts_pin, NRF_GPIO_PIN_PULLUP);
11261125
}
11271126
} else {
11281127
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
@@ -1664,13 +1664,13 @@ static int uarte_instance_init(const struct device *dev,
16641664
nrf_gpio_cfg_output(config->pseltxd);
16651665

16661666
if (config->pselrxd != NRF_UARTE_PSEL_DISCONNECTED) {
1667-
nrf_gpio_cfg_input(config->pselrxd, NRF_GPIO_PIN_NOPULL);
1667+
nrf_gpio_cfg_input(config->pselrxd, NRF_GPIO_PIN_PULLUP);
16681668
}
16691669

16701670
nrf_uarte_txrx_pins_set(uarte, config->pseltxd, config->pselrxd);
16711671

16721672
if (config->pselcts != NRF_UARTE_PSEL_DISCONNECTED) {
1673-
nrf_gpio_cfg_input(config->pselcts, NRF_GPIO_PIN_NOPULL);
1673+
nrf_gpio_cfg_input(config->pselcts, NRF_GPIO_PIN_PULLUP);
16741674
}
16751675

16761676
if (config->pselrts != NRF_UARTE_PSEL_DISCONNECTED) {
@@ -1757,7 +1757,7 @@ static void uarte_nrfx_pins_enable(const struct device *dev, bool enable)
17571757
nrf_gpio_pin_write(tx_pin, 1);
17581758
nrf_gpio_cfg_output(tx_pin);
17591759
if (rx_pin != NRF_UARTE_PSEL_DISCONNECTED) {
1760-
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_NOPULL);
1760+
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_PULLUP);
17611761
}
17621762

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

17681768
if (IS_CTS_PIN_SET(get_dev_config(dev)->flags)) {
17691769
nrf_gpio_cfg_input(cts_pin,
1770-
NRF_GPIO_PIN_NOPULL);
1770+
NRF_GPIO_PIN_PULLUP);
17711771
}
17721772
} else {
17731773
nrf_gpio_cfg_default(tx_pin);

0 commit comments

Comments
 (0)