Closed sylvanoMTL closed 4 months ago
This is a burst read of all 14 data bytes in consecutive registers starting with the first one.
On Tue, Apr 23, 2024 at 7:12 AM sylvanoMTL @.***> wrote:
Hi there, I am trying to understand the mechanism behind the readData() method it looks like the read is done on register ICM42688_TEMP_DATA1 (0x1D):
void ICM42688::readData(int16_t * destination) { uint8_t rawData[14]; // x/y/z accel register data stored here _i2c_bus->readBytes(ICM42688_ADDRESS, ICM42688_TEMP_DATA1, 14, &rawData[0]); // Read the 14 raw data registers into data array destination[0] = ((int16_t)rawData[0] << 8) | rawData[1] ; // Turn the MSB and LSB into a signed 16-bit value destination[1] = ((int16_t)rawData[2] << 8) | rawData[3] ; destination[2] = ((int16_t)rawData[4] << 8) | rawData[5] ; destination[3] = ((int16_t)rawData[6] << 8) | rawData[7] ; destination[4] = ((int16_t)rawData[8] << 8) | rawData[9] ; destination[5] = ((int16_t)rawData[10] << 8) | rawData[11] ; destination[6] = ((int16_t)rawData[12] << 8) | rawData[13] ; }
None of the other data registers are read, these are referenced p61 of the datasheet https://invensense.tdk.com/wp-content/uploads/2020/04/ds-000347_icm-42688-p-datasheet.pdf
Am I missing something ?
— Reply to this email directly, view it on GitHub https://github.com/kriswiner/ICM42688/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKTYJV2ENAP7OFKUJH3Y6ZT6HAVCNFSM6AAAAABGVAQXGSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TQOJZGUZTIMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
After each register is read, the register address (pointer) is automatically incremented by the sensor...thus allowing burst reading, etc. This is pretty common, although in some cases (i.e., ST sensors) one has to set a configuration bit to allow automatic incrementing of the register address....
On Tue, Apr 23, 2024 at 1:20 PM Tlera Corporation @.***> wrote:
This is a burst read of all 14 data bytes in consecutive registers starting with the first one.
On Tue, Apr 23, 2024 at 7:12 AM sylvanoMTL @.***> wrote:
Hi there, I am trying to understand the mechanism behind the readData() method it looks like the read is done on register ICM42688_TEMP_DATA1 (0x1D):
void ICM42688::readData(int16_t * destination) { uint8_t rawData[14]; // x/y/z accel register data stored here _i2c_bus->readBytes(ICM42688_ADDRESS, ICM42688_TEMP_DATA1, 14, &rawData[0]); // Read the 14 raw data registers into data array destination[0] = ((int16_t)rawData[0] << 8) | rawData[1] ; // Turn the MSB and LSB into a signed 16-bit value destination[1] = ((int16_t)rawData[2] << 8) | rawData[3] ; destination[2] = ((int16_t)rawData[4] << 8) | rawData[5] ; destination[3] = ((int16_t)rawData[6] << 8) | rawData[7] ; destination[4] = ((int16_t)rawData[8] << 8) | rawData[9] ; destination[5] = ((int16_t)rawData[10] << 8) | rawData[11] ; destination[6] = ((int16_t)rawData[12] << 8) | rawData[13] ; }
None of the other data registers are read, these are referenced p61 of the datasheet https://invensense.tdk.com/wp-content/uploads/2020/04/ds-000347_icm-42688-p-datasheet.pdf
Am I missing something ?
— Reply to this email directly, view it on GitHub https://github.com/kriswiner/ICM42688/issues/10, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKTYJV2ENAP7OFKUJH3Y6ZT6HAVCNFSM6AAAAABGVAQXGSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TQOJZGUZTIMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Great thanks for those explanations, After browsing your code again and reading the datasheet p9 and p66 and, it makes much more sense to me! I completely ignored what a burst reading was, so thanks again.
Hi there, I am trying to understand the mechanism behind the readData() method it looks like the read is done on register ICM42688_TEMP_DATA1 (0x1D):
None of the other data registers are read, these are referenced p61 of the datasheet
Am I missing something ?