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 <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2021-06-17 14:47:56 +02:00 committed by Ioannis Glaropoulos
commit 3656ba5ae9
2 changed files with 8 additions and 9 deletions

View file

@ -1664,13 +1664,13 @@ static int uarte_instance_init(const struct device *dev,
nrf_gpio_cfg_output(config->pseltxd);
if (config->pselrxd != NRF_UARTE_PSEL_DISCONNECTED) {
nrf_gpio_cfg_input(config->pselrxd, NRF_GPIO_PIN_NOPULL);
nrf_gpio_cfg_input(config->pselrxd, NRF_GPIO_PIN_PULLUP);
}
nrf_uarte_txrx_pins_set(uarte, config->pseltxd, config->pselrxd);
if (config->pselcts != NRF_UARTE_PSEL_DISCONNECTED) {
nrf_gpio_cfg_input(config->pselcts, NRF_GPIO_PIN_NOPULL);
nrf_gpio_cfg_input(config->pselcts, NRF_GPIO_PIN_PULLUP);
}
if (config->pselrts != NRF_UARTE_PSEL_DISCONNECTED) {
@ -1757,7 +1757,7 @@ static void uarte_nrfx_pins_enable(const struct device *dev, bool enable)
nrf_gpio_pin_write(tx_pin, 1);
nrf_gpio_cfg_output(tx_pin);
if (rx_pin != NRF_UARTE_PSEL_DISCONNECTED) {
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_NOPULL);
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_PULLUP);
}
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)
if (IS_CTS_PIN_SET(get_dev_config(dev)->flags)) {
nrf_gpio_cfg_input(cts_pin,
NRF_GPIO_PIN_NOPULL);
NRF_GPIO_PIN_PULLUP);
}
} else {
nrf_gpio_cfg_default(tx_pin);