hello ,
During my twim0 initialization, I have configured clear_bus_init as true and hold_bus_uninit as false. But i always get hold_bus_uninit as true.
then I dig into nrf_drv_twi.c file , i found that in nrf_drv_twi_init function , function gets my settings as "nrf_drv_twi_config_t const * p_config,"
but then calls nrfx_twim_init function with (nrfx_twim_config_t const *)p_config,...
so
nrfx_twim_config_t structure's the last member is hold_bus_uninit,
typedef struct
{
uint32_t scl; ///< SCL pin number.
uint32_t sda; ///< SDA pin number.
nrf_twim_frequency_t frequency; ///< TWIM frequency.
uint8_t interrupt_priority; ///< Interrupt priority.
bool hold_bus_uninit; ///< Hold pull up state on GPIO pins after uninit.
} nrfx_twim_config_t;
but the our data was a nrf_drv_twi_config_t has one more element that is clear_bus_init...
typedef struct
{
uint32_t scl; ///< SCL pin number.
uint32_t sda; ///< SDA pin number.
nrf_drv_twi_frequency_t frequency; ///< TWI frequency.
uint8_t interrupt_priority; ///< Interrupt priority.
bool clear_bus_init; ///< Clear bus during init.
bool hold_bus_uninit; ///< Hold pull up state on gpio pins after uninit.
} nrf_drv_twi_config_t;
so when we cast nrf_drv_twi_config_t as nrfx_twim_config_t , we are writing "nrf_drv_twi_config_t 's clear_bus_init" over "nrfx_twim_config_t 's hold_bus_uninit"
Could you please confirm , i am using sdk16 but i just check sdk17 also has no any definition for clear_bus_init in nrfx_twim_config_t structure.
ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const * p_instance,
nrf_drv_twi_config_t const * p_config,
nrf_drv_twi_evt_handler_t event_handler,
void * p_context)
{
uint32_t inst_idx = p_instance->inst_idx;
m_handlers[inst_idx] = event_handler;
m_contexts[inst_idx] = p_context;
if(p_config->clear_bus_init)
{
/* Send clocks (max 9) until slave device back from stuck mode */
twi_clear_bus(p_config);
}
ret_code_t result = 0;
if (NRF_DRV_TWI_USE_TWIM)
{
result = nrfx_twim_init(&p_instance->u.twim,
(nrfx_twim_config_t const *)p_config,
event_handler ? twim_evt_handler : NULL,
(void *)inst_idx);
}
else if (NRF_DRV_TWI_USE_TWI)
{
result = nrfx_twi_init(&p_instance->u.twi,
(nrfx_twi_config_t const *)p_config,
event_handler ? twi_evt_handler : NULL,
(void *)inst_idx);
}
return result;
}

