Hi, I am trying to read a 24-bit register (with 8-bit address) using the I2C (nrf52). And the timing diagram is given below.
Basically I created a 3-element array (24-bit in total)
static uint8_t m_sample[3];
and use nrf_drv_twi_rx to store the value into the array.
void read_register(uint8_t address){
ret_code_t err_code;
m_xfer_done = false;
err_code = nrf_drv_twi_tx(&m_twi, SLAVE_ADDR, &address, 1, false);
APP_ERROR_CHECK(err_code);
while (m_xfer_done == false);
m_xfer_done = false;
/* Read from register */
err_code = nrf_drv_twi_rx(&m_twi, SLAVE_ADDR, m_sample, sizeof(m_sample));
APP_ERROR_CHECK(err_code);
while (m_xfer_done == false){};
}
Can anyone tell me if this works? Thank you very much.
P.S. How does the ACK and NACK work in nrf52? How can I control these two bit?