Hi guys,
On my application, I ported the code from TWI_scanner example (SDK14) and it is connected to a temperature sensor the which is read every 45 seconds, It is working properly for longs periods. I tried changing the optimization Level is 3 (-O3) to reduce the application size, but If I change the optimization level all goes wrong with TWI
I was playing changing the optimization level from 2-1 and rebuilding my project, but the functions nrf_drv_twi_tx returns error 3 NRF_ERROR_INVALID_ADDR and nrf_drv_twi_rx also return error 3 NRF_ERROR_DRV_TWI_ERR_OVERRUN.
why is happening this behavior?
//function for write nrf_drv_twi_tx(&m_twi, address, (uint8_t *)&sample_data, 1, true)) //function for read nrf_drv_twi_rx(&m_twi, address, (uint8_t *)&sample_data2, sizeof(sample_data))
I am using the TWI in blocking mode:
const nrf_drv_twi_config_t twi_config =
{
.scl = scl_pin,
.sda = sda_pin,
.frequency = NRF_TWI_FREQ_100K,
.interrupt_priority = APP_IRQ_PRIORITY_HIGH,
.clear_bus_init = false
};
err_code = nrf_drv_twi_init(&m_twi, &twi_config, NULL, NULL);
APP_ERROR_CHECK(err_code);
nrf_drv_twi_enable(&m_twi);
Module nRF52 DK (I am using the softdevice)
Regards,
Meliodas