sparkfun / SparkFun_ICM-20948_ArduinoLibrary

Arduino support for ICM_20948 w/ portable C backbone
Other
153 stars 67 forks source link

Different response time of ICM20948 #139

Open Zzx-J opened 5 months ago

Zzx-J commented 5 months ago

Hi,

I have serveral ICM20948 and i am using them with the DMP interrupt on to get 9-axis quaternions.

I have found that the response time of the IMU are different. i.e. when doing the same movement, there would be a lag of the output for some of the IMUs. Is that normal?

I have upload the same code for each imu, the sampling frequency, ODR of the IMUs should be the same. Additionally i have tried different ODRs but still there are lags in response for some of the IMUs. I have also checked the data output frequency, again, they are same as expected.

Anybody help please?

PaulZC commented 5 months ago

Hi @Zzx-J ,

I can't help you with this question. But I am happy to leave it open in case someone else can.

Best wishes, Paul

faxik commented 2 months ago

I'm experiencing the same. However, if I add some debug prints to the sketch, I see that the time inconsistency comes from the status sequence:

status=ICM_20948_Stat_FIFOMoreDataAvail
status=ICM_20948_Stat_FIFOIncompleteData
status=ICM_20948_Stat_FIFOIncompleteData
status=ICM_20948_Stat_FIFOIncompleteData
status=ICM_20948_Stat_FIFOIncompleteData
status=ICM_20948_Stat_FIFOIncompleteData
status=ICM_20948_Stat_FIFOIncompleteData```

This, in turn, comes from the lines (1253–2154) in ICM_20948_C.c:

```c++
    if (fifo_count < icm_20948_DMP_Quat9_Bytes)
      return ICM_20948_Stat_FIFOIncompleteData;

I believe this has something to do with the readout requests (I guess a misalignment in an earlier request or another corruption). Maybe the correct way to process is to clean the FIFO in such a case.