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

Disable TWI pull-up resistor in nRF52840 DK

Hi,

I am using the twi_sensor example in the board PCA10056 with SDK v15.2.0. I am trying to disable the internal pull-up resistors of SDA and SCL lines to use external resistors instead, but they are always pulled up. I try to modify the definition of SCL_PIN_INIT_CONF and SCL_PIN_INIT_CONF_CLR in nrf_drv_twi.c, changing the parameters GPIO_PIN_CNF_PULL_Pullup for GPIO_PIN_CNF_PULL_Disabled. I have also set it as pull-down to see if there is any change but SDA and SCL keep pulled up at VDD.

Am I missing any other change needed to disable pull-up resistors?

Thanks!

Parents
  • Hi,

    The initial pin configuration during driver initialization is set by the TWI_PIN_INIT macro in nrfx_twi.c. You can disable the pull up resistor by modifying it to this (using NRF_GPIO_PIN_NOPULL instead of NRF_GPIO_PIN_PULLUP):

    #define TWI_PIN_INIT(_pin) nrf_gpio_cfg((_pin),                     \
                                            NRF_GPIO_PIN_DIR_INPUT,     \
                                            NRF_GPIO_PIN_INPUT_CONNECT, \
                                            NRF_GPIO_PIN_NOPULL,        \
                                            NRF_GPIO_PIN_S0D1,          \
                                            NRF_GPIO_PIN_NOSENSE)

Reply
  • Hi,

    The initial pin configuration during driver initialization is set by the TWI_PIN_INIT macro in nrfx_twi.c. You can disable the pull up resistor by modifying it to this (using NRF_GPIO_PIN_NOPULL instead of NRF_GPIO_PIN_PULLUP):

    #define TWI_PIN_INIT(_pin) nrf_gpio_cfg((_pin),                     \
                                            NRF_GPIO_PIN_DIR_INPUT,     \
                                            NRF_GPIO_PIN_INPUT_CONNECT, \
                                            NRF_GPIO_PIN_NOPULL,        \
                                            NRF_GPIO_PIN_S0D1,          \
                                            NRF_GPIO_PIN_NOSENSE)

Children
Related