This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Does APP_UART_FIFO_INIT overwrite the PIN_CNF register for the assigned tx_pin_no?

Each time we wake up our serial port we call APP_UART_FIFO_INIT because we want our buffers to be cleared when we wake the serial. Does this also overwrite the PIN_CNF register for the assigned tx_pin_no? I'd rather only configure the pin once, not after every time I call APP_UART_FIFO_INIT?

  • Check apply_config(...) in nrf_drv_uart.c file, this is called by the APP_UART_FIFO_INIT macro.

    nrf_gpio_pin_set(p_config->pseltxd);
    nrf_gpio_cfg_output(p_config->pseltxd);
    nrf_gpio_cfg_input(p_config->pselrxd, NRF_GPIO_PIN_NOPULL);
    

    So yes, the PIN_CNF register is overwritten as so :

    nrf_gpio_cfg(
                pin_number,
                NRF_GPIO_PIN_DIR_OUTPUT,
                NRF_GPIO_PIN_INPUT_DISCONNECT,
                NRF_GPIO_PIN_NOPULL,
                NRF_GPIO_PIN_S0S1,
                NRF_GPIO_PIN_NOSENSE);
    

    Try using app_uart_flush() instead.

Related