Is it possible to use internal pull-up/pull-down resistors with I2C, UART, etc?

I need pull-up/pull-down resistors on my UART and I2C lines and am wondering if I can enable the pull-up/pull-down resistors instead.  If this possible?  I can see how to configure them for GPIO, but I'm wondering if I use the same approach if it would interfere with the UART/I2C drivers.  Thanks

Other info:
nRF52480

nRF Connect SDK v2.1.0

Parents
  • After some digging, I found in `nrf_twim.c`:

    #define TWIM_PIN_INIT(_pin, _drive) nrf_gpio_cfg((_pin),                     \
                                                     NRF_GPIO_PIN_DIR_INPUT,     \
                                                     NRF_GPIO_PIN_INPUT_CONNECT, \
                                                     NRF_GPIO_PIN_PULLUP,        \
                                                     (_drive),                   \
                                                     NRF_GPIO_PIN_NOSENSE)

    Looks like both the SDA and SCL lines have the pull-up resistor enabled by default.  For UART, this is what I've found so far in `nrfx_uarte.c`:

            if (p_config->pseltxd != NRF_UARTE_PSEL_DISCONNECTED)
            {
                nrf_gpio_pin_set(p_config->pseltxd);
                nrf_gpio_cfg_output(p_config->pseltxd);
            }
            if (p_config->pselrxd != NRF_UARTE_PSEL_DISCONNECTED)
            {
                nrf_gpio_cfg_input(p_config->pselrxd, NRF_GPIO_PIN_NOPULL);
            }

    Looks like the RX pin does NOT use a pull-up, which is what I'd like.

    So maybe two questions:

    1. Is my understanding correct?  By default with twim 13k pull-up resistors are enabled for both SDA and SCL?  And for UART RX does not enable by default?
    2. Is there any way to enable the pull-up for my UART RX line within my application instead of modifying my library?

    Thanks

Reply
  • After some digging, I found in `nrf_twim.c`:

    #define TWIM_PIN_INIT(_pin, _drive) nrf_gpio_cfg((_pin),                     \
                                                     NRF_GPIO_PIN_DIR_INPUT,     \
                                                     NRF_GPIO_PIN_INPUT_CONNECT, \
                                                     NRF_GPIO_PIN_PULLUP,        \
                                                     (_drive),                   \
                                                     NRF_GPIO_PIN_NOSENSE)

    Looks like both the SDA and SCL lines have the pull-up resistor enabled by default.  For UART, this is what I've found so far in `nrfx_uarte.c`:

            if (p_config->pseltxd != NRF_UARTE_PSEL_DISCONNECTED)
            {
                nrf_gpio_pin_set(p_config->pseltxd);
                nrf_gpio_cfg_output(p_config->pseltxd);
            }
            if (p_config->pselrxd != NRF_UARTE_PSEL_DISCONNECTED)
            {
                nrf_gpio_cfg_input(p_config->pselrxd, NRF_GPIO_PIN_NOPULL);
            }

    Looks like the RX pin does NOT use a pull-up, which is what I'd like.

    So maybe two questions:

    1. Is my understanding correct?  By default with twim 13k pull-up resistors are enabled for both SDA and SCL?  And for UART RX does not enable by default?
    2. Is there any way to enable the pull-up for my UART RX line within my application instead of modifying my library?

    Thanks

Children
Related