Requesting Sample I2C Master Example

Hello,

We are using the twi master with twi slave example to confirm out device is working as a I2C master.

First question is there another I2C sample as a master ?

In the sdk_config.h there are pull ups for NRF_TWIS and TWIS pins, but we are not using the slave portion of the example.

How do we pull up the I2C Master Pins ?

In the twi_master_init , is there a way to configure the pullups ? We would like to test this being able to pull up and pull down.

static ret_code_t twi_master_init(void)
{
    ret_code_t ret;
    const nrf_drv_twi_config_t config =
    {
       .scl                = TWI_SCL_M,
       .sda                = TWI_SDA_M,
       .frequency          = NRF_DRV_TWI_FREQ_400K,
       .interrupt_priority = APP_IRQ_PRIORITY_HIGH,
       .clear_bus_init     = false
    };

    
    ret = nrf_drv_twi_init(&m_twi_master, &config, NULL, NULL);

    if (NRF_SUCCESS == ret)
    {
        nrf_drv_twi_enable(&m_twi_master);
    }

    return ret;
}

Thanks

Parents
  • Hello,

    The TWIM pins in this example are set in a file called config.h, but only the pin numbers, not the pull configuration.

    If this example is not modified, the pull configuration is set in nrfx_twi.c -> nrfx_twi_init() -> TWI_PIN_INIT() -> where it is hardcoded to pullup.

    Just FYI: In the unmodified twi_master_with_twis_slave example, the twis' pull is set in eeprom_simulator.c -> eeprom_simulator_init(), not in sdk_config.h.

    BR,
    Edvin

Reply
  • Hello,

    The TWIM pins in this example are set in a file called config.h, but only the pin numbers, not the pull configuration.

    If this example is not modified, the pull configuration is set in nrfx_twi.c -> nrfx_twi_init() -> TWI_PIN_INIT() -> where it is hardcoded to pullup.

    Just FYI: In the unmodified twi_master_with_twis_slave example, the twis' pull is set in eeprom_simulator.c -> eeprom_simulator_init(), not in sdk_config.h.

    BR,
    Edvin

Children
No Data
Related