Hello ,
I have one sensor with I2C and configured with BLE peripheral example code ( BLE_Blinky as well BLE_Freertos_hrs) .
But whenever I Tried to read/wrtie over I2C I get app_error ( it goes to app_error_fault_handler )
In , NRF_DRV_TWI_INSTANCE(TWI_INSTANCE_ID) , I have tried with instance 0 and 1 ,but the error is same .
If i remove BLE initializations then the i2c works properly .
below are the ble inits .
ble_stack_init();
gap_params_init();
gatt_init();
advertising_init();
services_init();
sensor_simulator_init();
conn_params_init();
peer_manager_init();
advertising_start(&erase_bonds);
it goes here and stuck :uint8_t pah8112_i2c_write(size_t addr, uint8_t const * pdata, size_t size)
{
ret_code_t ret; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< at this point and after that it goes to app_error_fault_handler
/* Memory device supports only limited number of bytes written in sequence */
if(size > (EEPROM_SIM_SEQ_WRITE_MAX))
{
return NRF_ERROR_INVALID_LENGTH;
}
/* All written data has to be in the same page */
if((addr/(EEPROM_SIM_SEQ_WRITE_MAX)) != ((addr+size-1)/(EEPROM_SIM_SEQ_WRITE_MAX)))
{
return NRF_ERROR_INVALID_ADDR;
}
do
{
uint8_t buffer[1 + EEPROM_SIM_SEQ_WRITE_MAX]; /* Addr + data */
buffer[0] = (uint8_t)addr;
memcpy(buffer+1, pdata, size);
ret = nrf_drv_twi_tx(&m_twi_master, PAH8112_ADDR, buffer, size+1, false);
}while(0);
return ret;
}