Been working to get the TWI communicating to a LIS331HH and been having tons of trouble getting it functioning.
I do an init like the example
void twi_init (void)
{
ret_code_t err_code;
const nrf_drv_twi_config_t twi_config = {
.scl = SCL_PORT,
.sda = SDA_PORT,
.frequency = NRF_DRV_TWI_FREQ_100K,
.interrupt_priority = APP_IRQ_PRIORITY_MID,
.clear_bus_init = false
};
err_code = nrf_drv_twi_init(&m_twi, &twi_config, twi_handler, NULL);
APP_ERROR_CHECK(err_code);
nrf_drv_twi_enable(&m_twi);
}
then when i try to do any tx/rx
ret_code_t err_code;
uint8_t twidat = 0;
err_code = nrf_drv_twi_rx(&m_twi,0x18,&twidat,sizeof(twidat));
APP_ERROR_CHECK(err_code);
following the code by stepping in it goes to this function and hardfaults
__STATIC_INLINE void nrf_twi_int_enable(NRF_TWI_Type * p_reg,
uint32_t mask)
{
p_reg->INTENSET = mask;
}

thanks,
Kevin


