Hey hi,
I am trying to establish communication between ADT7410 and nRF52840 using I2C that is the TWI module.
I have successfully checked the address of the ADT7410 with nRF52840.
The output of so is as follow:
00> <info> app: Application Started
00>
00> <info> app: Entered the twi_init loop
00>
00> <info> app: twi is been initalized
00>
00> <info> app: error_code is : 0x0
00>
00> <info> app: Successfully detected a device at address : 0x48
00>
But unable to get the temperature value from the sensor.
Tried debugging through NRF_LOG_INFO
the program doesn't print "The Error code 2 is %x" from the ADT7410_set_mode.
ADT7410_set_mode function is as follow:
void ADT7410_set_mode(void)
{
NRF_LOG_INFO("We have entered ADT7410 set mode");
NRF_LOG_FLUSH();
ret_code_t err_code;
/* Writing to LM75B_REG_CONF "0" set temperature sensor in NORMAL mode. */
uint8_t reg[2] = {ADT7410_REG_CONF, NORMAL_MODE};
err_code = nrf_drv_twi_tx(&m_twi, ADT7410_ADDR, reg, sizeof(reg), false);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("The Error code 1 is %x",err_code);
NRF_LOG_FLUSH();
while (m_xfer_done == false);
/* Writing to pointer byte. */
reg[0] = ADT7410_REG_TEMP;
m_xfer_done = false;
err_code = nrf_drv_twi_tx(&m_twi, ADT7410_ADDR, reg,1, false);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("The Error code 2 is %x",err_code);
NRF_LOG_FLUSH();
while (m_xfer_done == false);
}
Please do guide me to solve this issue.