In the main function, this works.
Works ..
err_code = app_timer_start(my_led_timer_id, APP_TIMER_TICKS(4500, APP_TIMER_PRESCALER), NULL);
APP_ERROR_CHECK(err_code);
err_code = nrf_drv_twi_tx(&m_twi_sht_30, SHT_ADDRESS, reg, sizeof(reg), false);
APP_ERROR_CHECK(err_code);
m_xfer_done = false;
for (;;)
{
app_sched_execute();
power_manage();
}
Not works, I got NRF_DRV_TWI_EVT_DATA_NACK error..
err_code = app_timer_start(my_led_timer_id, APP_TIMER_TICKS(4500, APP_TIMER_PRESCALER), NULL);
APP_ERROR_CHECK(err_code);
sht_measurement();
for (;;)
{
app_sched_execute();
power_manage();
}
static void sht_measurement(void){
uint32_t err_code;
uint8_t reg[2] = {0x2c, 0x06};
err_code = nrf_drv_twi_tx(&m_twi_sht_30, SHT_ADDRESS, reg, sizeof(reg), false);
APP_ERROR_CHECK(err_code);
m_xfer_done = false;
}
and I cannot call "nrf_drv_twi_tx" in the timer event handler function? When I try to call "nrf_drv_twi_tx" in the timer event handler (for requesting data from SHTx sensor),
I got same error, NRF_DRV_TWI_EVT_DATA_NACK .