Skip to content

Commit 6a6ed17

Browse files
Mierunskiioannisg
authored andcommitted
drivers: uart: Properly configure pins in NRF UARTE power management
Configure pins before enabling and after disabling UARTE through power management functions. Signed-off-by: Mieszko Mierunski <[email protected]>
1 parent e8e668a commit 6a6ed17

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/serial/uart_nrfx_uarte.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,8 +1205,14 @@ static int uarte_instance_init(struct device *dev,
12051205
static void uarte_nrfx_set_power_state(struct device *dev, u32_t new_state)
12061206
{
12071207
NRF_UARTE_Type *uarte = get_uarte_instance(dev);
1208+
u32_t tx_pin = nrf_uarte_tx_pin_get(uarte);
1209+
u32_t rx_pin = nrf_uarte_rx_pin_get(uarte);
12081210

12091211
if (new_state == DEVICE_PM_ACTIVE_STATE) {
1212+
nrf_gpio_pin_write(tx_pin, 1);
1213+
nrf_gpio_cfg_output(tx_pin);
1214+
nrf_gpio_cfg_input(rx_pin, NRF_GPIO_PIN_NOPULL);
1215+
12101216
nrf_uarte_enable(uarte);
12111217
#ifdef CONFIG_UART_ASYNC_API
12121218
if (get_dev_data(dev)->async) {
@@ -1225,6 +1231,8 @@ static void uarte_nrfx_set_power_state(struct device *dev, u32_t new_state)
12251231
#ifdef CONFIG_UART_ASYNC_API
12261232
if (get_dev_data(dev)->async) {
12271233
nrf_uarte_disable(uarte);
1234+
nrf_gpio_cfg_default(tx_pin);
1235+
nrf_gpio_cfg_default(rx_pin);
12281236
return;
12291237
}
12301238
#endif
@@ -1234,6 +1242,8 @@ static void uarte_nrfx_set_power_state(struct device *dev, u32_t new_state)
12341242
}
12351243
nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXTO);
12361244
nrf_uarte_disable(uarte);
1245+
nrf_gpio_cfg_default(tx_pin);
1246+
nrf_gpio_cfg_default(rx_pin);
12371247
}
12381248
}
12391249

0 commit comments

Comments
 (0)