drivers: serial: nrfx: disable before setting pin config

Per the nrf9160 datasheet, UARTE must be disabled prior to configuring
PSEL.TXD, PSEL.RXD, PSEL.CTS, and/or PSEL.RTS.  This also ensures that
any prior running code, such as a bootloader, which leaves the UART
enabled will not prevent the Zephyr application from changing the
configuration.

Make a similar change also to the uart_nrf_uart.c driver for the
nRF5 series.

Fixes 27080

Signed-off-by: Pete Skeggs <peter.skeggs@nordicsemi.no>
This commit is contained in:
Pete Skeggs 2020-07-23 16:12:02 -07:00 committed by Anas Nashif
parent 80e54e04ed
commit d56e0b0b40
2 changed files with 3 additions and 0 deletions

View file

@ -969,6 +969,8 @@ static int uart_nrfx_init(struct device *dev)
{
int err;
nrf_uart_disable(uart0_addr);
/* Setting default height state of the TX PIN to avoid glitches
* on the line during peripheral activation/deactivation.
*/

View file

@ -1268,6 +1268,7 @@ static int uarte_instance_init(struct device *dev,
NRF_UARTE_Type *uarte = get_uarte_instance(dev);
struct uarte_nrfx_data *data = get_dev_data(dev);
nrf_uarte_disable(uarte);
nrf_gpio_pin_write(config->pseltxd, 1);
nrf_gpio_cfg_output(config->pseltxd);