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

SDK 14.2 TWI disable internal pull-up resistor

I am working with NRF52832 master with TWI slave device, however , since our board already has external pull-up resistors (10K) ,  how do I disable TWI internal pull up resistors ?

I am using SDK14.2 

Thank you in advance
Ildefonso

Parents
  • Hi

    The internal pull-up is set in the nrf_drv_twi_init() function in the nrf_drv_twi.c file:

    NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_INIT_CONF;
    NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_INIT_CONF;

    SCL_PIN_INIT_CONF is defined as: 

    #define SCL_PIN_INIT_CONF     ( (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \
                                  | (GPIO_PIN_CNF_DRIVE_S0D1     << GPIO_PIN_CNF_DRIVE_Pos) \
                                  | (GPIO_PIN_CNF_PULL_Pullup    << GPIO_PIN_CNF_PULL_Pos)  \
                                  | (GPIO_PIN_CNF_INPUT_Connect  << GPIO_PIN_CNF_INPUT_Pos) \
                                  | (GPIO_PIN_CNF_DIR_Input      << GPIO_PIN_CNF_DIR_Pos))

    Where the pull-up is set with the GPIO_PIN_CNF_PULL_Pullup with GPIO_PIN_CNF_PULL_Disabled. Replace  GPIO_PIN_CNF_PULL_Pullup with GPIO_PIN_CNF_PULL_Disabled

    Use the same method for changing the internal pull-up on the SDA pin,

    Jared 

Reply
  • Hi

    The internal pull-up is set in the nrf_drv_twi_init() function in the nrf_drv_twi.c file:

    NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_INIT_CONF;
    NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_INIT_CONF;

    SCL_PIN_INIT_CONF is defined as: 

    #define SCL_PIN_INIT_CONF     ( (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \
                                  | (GPIO_PIN_CNF_DRIVE_S0D1     << GPIO_PIN_CNF_DRIVE_Pos) \
                                  | (GPIO_PIN_CNF_PULL_Pullup    << GPIO_PIN_CNF_PULL_Pos)  \
                                  | (GPIO_PIN_CNF_INPUT_Connect  << GPIO_PIN_CNF_INPUT_Pos) \
                                  | (GPIO_PIN_CNF_DIR_Input      << GPIO_PIN_CNF_DIR_Pos))

    Where the pull-up is set with the GPIO_PIN_CNF_PULL_Pullup with GPIO_PIN_CNF_PULL_Disabled. Replace  GPIO_PIN_CNF_PULL_Pullup with GPIO_PIN_CNF_PULL_Disabled

    Use the same method for changing the internal pull-up on the SDA pin,

    Jared 

Children
No Data
Related