Originally Posted by noobee
i think i found the source of the "significant" jitter, it is either the i2c or imu libraries (more likely i2c). i think it is disabling interrupts for long-ish periods of time. this is with my mpu6050 board, but the mpu6050 and itg3205 libraries are based off the same base in i2cdevlib.
so, i'll look into using alternate i2c access functions that does not use the arduino Wire library.
i'll also look into a lock-free implementation of shared vars access between the isrs and main loop. the current atomic access operations will disable interrupts (though it seems that the disable time is quite small).
the +/-5us-ish jitter is probably coming from the 4us micros() granularity as you indicated. using a true microsecond timer1 could help there..
They have Interlock.Exchange(...) ? Or that causing interrupt disable also. That is normally the fasted lock for anything needing sync. Or volatile if they have that. Have no clue on the memory model of that system.