* it would fail when calls MPU9250::start() from DevMgr::getHandle();
* for example, checking MPU9250 WHOAMI register failed.
* mark the error in the h.m_errno in function DevMgr::getHandle() for such case.
* check the h.m_errno if any error happened.
*/
if (h.getError())
m_done = true;
2> The df_imu_test module would not exit if the IMU FIFO corruption happened;
The test would not finish forever, the reproduce rate is less than 3%. Not all FIFO corruption would run into this issue. Normally, the call stacks are when getting the IMU sensor data:
ImuSensor::getSensorData()
me->m_synchronize.waitOnSignal(0);
When the data is ready, using below method for notification.
m_synchronize.signal();
When the FIFO corruption happens, For a unknown reason, the signal never comes again.
Then df… module would hang. This should be an QURT related issue.
df_imu_test module would hang in 20 times loop test. With this patch, no issue was found after 300 times loop test.
The fix includes:
1> The df_imu_test module would not exit if checking the WHOAMI register failed;
2> The df_imu_test module would not exit if the IMU FIFO corruption happened;
3> Removing some warning msg from logs which are not for QURT;
The below are the details:
1> The df_imu_test module would not exit if checking the WHOAMI register failed;
[08500/00] 00:56.733 HAP:28754:320745 count: 1000 0095 test.cpp [08500/00] 00:56.733 HAP:28754:320808 IMU: accel: [0.27, 0.47, 9.84] m/s^2 0143 ImuSensor.hpp [08500/00] 00:56.733 HAP:28754:320976 gyro: [-0.01, 0.01, -0.02] rad/s 0147 ImuSensor.hpp [08500/00] 00:56.735 HAP:28754:321134 mag: [0.458391, 0.849047, 0.017344] ga 0153 ImuSensor.hpp [08500/00] 00:56.735 HAP:28754:321312 temp: 53.30 C 0157 ImuSensor.hpp [08500/00] 00:56.735 HAP:28754:321428 Closing IMU sensor 0119 test.cpp [08500/00] 00:56.745 HAP:28754:331808 Test PASSED 0140 test.cpp [08500/00] 00:56.798 HAP:28734:81 Run it 0135 test.cpp [08500/00] 00:56.798 HAP:28733:18446744073709551544 WARNING: setRealtimeSched failed (not run as root?) 0357 DriverFramework.cpp [08500/00] 00:56.798 HAP:28734:582 MPU9250 sensor WHOAMI wrong: 0x0, should be: 0x71 0280 MPU9250.cpp
The fix is : keep the failure result in the h.m_errno when getting the handle, then check it before the test start.
2> The df_imu_test module would not exit if the IMU FIFO corruption happened;
The test would not finish forever, the reproduce rate is less than 3%. Not all FIFO corruption would run into this issue. Normally, the call stacks are when getting the IMU sensor data:
ImuSensor::getSensorData()
me->m_synchronize.waitOnSignal(0);
When the data is ready, using below method for notification.
m_synchronize.signal();
When the FIFO corruption happens, For a unknown reason, the signal never comes again.
Then df… module would hang. This should be an QURT related issue.
The related logs:
[08500/00] 14:36.615 HAP:69700:265790 count: 633 0095 test.cpp [08500/00] 14:36.615 HAP:69700:265855 IMU: accel: [0.83, 0.88, 9.98] m/s^2 0143 ImuSensor.hpp [08500/00] 14:36.615 HAP:69700:266023 gyro: [-0.01, 0.00, -0.01] rad/s 0147 ImuSensor.hpp [08500/00] 14:36.615 HAP:69700:266182 mag: [0.315820, 0.926396, -0.168234] ga 0153 ImuSensor.hpp [08500/00] 14:36.615 HAP:69700:266363 temp: 47.10 C 0157 ImuSensor.hpp [08500/00] 14:36.616 HAP:69700:266666 count: 640 0095 test.cpp [08500/00] 14:36.616 HAP:69700:266731 IMU: accel: [0.80, 0.76, 9.94] m/s^2 0143 ImuSensor.hpp [08500/00] 14:36.616 HAP:69700:266906 gyro: [-0.02, 0.00, -0.02] rad/s 0147 ImuSensor.hpp [08500/00] 14:36.616 HAP:69700:267053 mag: [0.315820, 0.926396, -0.168234] ga 0153 ImuSensor.hpp [08500/00] 14:36.616 HAP:69700:267230 temp: 46.88 C 0157 ImuSensor.hpp [08500/00] 14:36.617 HAP:69692:267790 FIFO corrupt, temp difference: 11.966759, last temp: 46.966759, current temp: 35.000000 0526 MPU9250.cpp
The fix is to add a timeout instead of infinite waiting.
+#ifndef __PX4_QURT me->m_synchronize.waitOnSignal(0); +#else
3> Removing some warning msg from logs which are not for QURT
The following logs are not for QURT:
[08500/00] 00:56.798 HAP:28733:18446744073709551544 WARNING: setRealtimeSched failed (not run as root?) 0357 DriverFramework.cpp
Related code:
ifndef __PX4_QURT
endif
__PX4_QURT is defined when compile the PX4, but not defined when build the DF along. So I add below in the makefile.