You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the code examples, if I run IMU.calibrateMPU9250(IMU.gyroBias, IMU.accelBias); to calibrate the bias, my program will crash with a divide-by-zero error. Upon further investigation, I found that
returns 0 and thus the lines 258-260 on MPU9250.cpp below will crash: accel_bias[0] /= (int32_t) packet_count; // Normalize sums to get average count biases accel_bias[1] /= (int32_t) packet_count; accel_bias[2] /= (int32_t) packet_count;
The way I fixed this was simply commenting out line 236 of MPU9250.cpp //writeByte(MPU9250_ADDRESS, FIFO_EN, 0x00); // Disable gyro and accelerometer sensors for FIFO
Now, the read operation will return a non-zero value.
The text was updated successfully, but these errors were encountered:
playztag
added a commit
to playztag/M5Stack
that referenced
this issue
Jun 20, 2021
Following the code examples, if I run
IMU.calibrateMPU9250(IMU.gyroBias, IMU.accelBias);
to calibrate the bias, my program will crash with a divide-by-zero error. Upon further investigation, I found thatreadBytes(MPU9250_ADDRESS, FIFO_COUNTH, 2, &data[0]); // read FIFO sample count fifo_count = ((uint16_t)data[0] << 8) | data[1];
returns 0 and thus the lines 258-260 on MPU9250.cpp below will crash:
accel_bias[0] /= (int32_t) packet_count; // Normalize sums to get average count biases accel_bias[1] /= (int32_t) packet_count; accel_bias[2] /= (int32_t) packet_count;
The way I fixed this was simply commenting out line 236 of MPU9250.cpp
//writeByte(MPU9250_ADDRESS, FIFO_EN, 0x00); // Disable gyro and accelerometer sensors for FIFO
Now, the read operation will return a non-zero value.
The text was updated successfully, but these errors were encountered: