Question
LSM6DS3 fifo read via i2c
I have been reading a 780 samples from lsm6ds3 FIFO via i2c (i2c_dev driver from linux) but the read is taking arround ~1.5 to 2 sec. this seems little unusual to me . is there any way to reduce the i2c read time ?.
Here is my read function:
static int32_t i2c_read_low_latency(int file,__u8 reg,__u8 *buff,__u16 len)
{
buff[0]=reg;
int temp=write(file, buff, 1);
temp=read(file, buff, len);
if ( temp!= len) {
/* ERROR HANDLING: i2c transaction failed */
printf("i2c transaction error \n");
}
return temp;
}This is the fifo read pseudo code:
for(780 samples in FIFO )
{
i2c_read_low_latency(fd_i2c4,LSM6DS3_FIFO_DATA_OUT_L,ch1,2); //read XLx
i2c_read_low_latency(fd_i2c4,LSM6DS3_FIFO_DATA_OUT_L,ch2,2); //read XLy
i2c_read_low_latency(fd_i2c4,LSM6DS3_FIFO_DATA_OUT_L,ch3,2); //read XLz
}