I have a hardware with NRF52832 module and successfully used the example twi-scanner to locate my I2C peripheral. I copied these parts over:
ret_code_t m41t62_init() { ret_code_t err_code; const nrf_drv_twi_config_t twi_config = { .scl = RTC_SCL, //pin 14 .sda = RTC_SDA, //pin 18 .frequency = NRF_TWI_FREQ_100K, .interrupt_priority = APP_IRQ_PRIORITY_HIGH, }; err_code = nrf_drv_twi_init(&m_twi, &twi_config, m41t62_twi_event_handler, NULL); APP_ERROR_CHECK(err_code); nrf_drv_twi_enable(&m_twi); return err_code; } uint32_t m41t62_test() { uint8_t data; ret_code_t err_code = nrf_drv_twi_rx(&m_twi, 0x68, &data, sizeof(data)); APP_ERROR_CHECK(err_code); return data; }
My own code produces this error on the line APP_ERROR_CHECK(err_code); in m41t62_test:
<info> TWI: Transfer type: XFER_RX.
<info> TWI: Transfer buffers length: primary: 1, secondary: 0.
<warning> TWI: Function: nrfx_twi_xfer, error code: NRF_ERROR_INTERNAL.
<error> app: ERROR 3 [NRF_ERROR_INTERNAL] at ./driver/m41t62lc6f.c:68
PC at: 0x0002CA85
<error> app: End of error report
What might be a difference that causes this?