ebelski / rust-copter

A quadcopter build using a Teensy running Rust and some other cool stuff that's yet to be determined.
MIT License
6 stars 1 forks source link

Measure how long it takes to acquire a 9DOF reading #2

Closed mciantyre closed 4 years ago

mciantyre commented 4 years ago

We talked about how long it takes to read data over I2C. I updated the MPU example to measure the time it takes to read all accelerometer, gyroscope, and magnetometer measurements. It gave me a reason to implement timers in the hardware crate.

~2.5ms @ 100KHz. Here's the logic analyzer output. Top-right corner shows the measured time of the transaction. Software timer indicates the same timing.

MPU_I2C_100KHz

We expect that we would be 4x faster at 400KHz. And yup, we see ~625us @ 400KHz. Logic analyzer output looks the same, but the scaling is different. Note the timing in the top-right corner. Software timer indicates the same thing.

MPU_I2C_400KHz

The example now uses 400KHz by default. Change it in the control.rs module.