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

Use UART, but make the TX pin open drain.

It is possible to switch the TX pin to open drain, when the UART is enabled on an nrf53?

My goal is to use the uart as a 1 wire interface, 

Parents Reply
  • Ah, I see. Try adding this function in SDKv1.5.1 uart_nrfx_uarte.c:

    NRF_STATIC_INLINE void cfg_tx_pin(uint32_t pin_number)
    {
        nrf_gpio_cfg(
            pin_number,
            NRF_GPIO_PIN_DIR_OUTPUT,
            NRF_GPIO_PIN_INPUT_CONNECT,  // Connect for single pix tx/rx
            NRF_GPIO_PIN_PULLUP, // If not using external pull-up
            NRF_GPIO_PIN_H0D1,  // Open drain
            NRF_GPIO_PIN_NOSENSE);
    }

    Then change this around line 1424 in uart_nrfx_uarte.c:

    	nrf_gpio_pin_write(config->pseltxd, 1);
    	nrf_gpio_cfg_output(config->pseltxd);

    to this:

    	nrf_gpio_pin_write(config->pseltxd, 1);
    	cfg_tx_pin(config->pseltxd);

Children
Related