This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Reading Irms and Vrms value from ACS71020 sensor using i2c protocol

Hi

I am reading the Irms and Vrms data from the register 0x20 so i am using nrf_drv_twi_rx(&m_twi, ACS71020_ADDRESS, m_sample, sizeof(m_sample)); where we specify only device address so how can we know that the data we are getting is from same register.

Acc_gyro_datasheet.pdf

Thankyou

Parents Reply
  • No as nrf_drv_twi_rx takes only device address

    As per my understanding first we need to write to the register then we have to read data from that register

     uint8_t acc = V_I_RMS;

    err_code = nrf_drv_twi_tx(&m_twi, ACS71020_ADDRESS, &acc, sizeof(acc), false);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_twi_rx(&m_twi, ACS71020_ADDRESS, m_sample, sizeof(m_sample));
    APP_ERROR_CHECK(err_code);

Children
Related