From d1ba78002d73b8adc9fe6fa6a1294be5a2f90f69 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 7 Jul 2014 16:44:14 +1000 Subject: [PATCH] AP_InertialSensor: added paranoid check for DRDY pin --- libraries/AP_InertialSensor/AP_InertialSensor_MPU9250.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/AP_InertialSensor/AP_InertialSensor_MPU9250.cpp b/libraries/AP_InertialSensor/AP_InertialSensor_MPU9250.cpp index 296759e2d7..542a600a1f 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor_MPU9250.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor_MPU9250.cpp @@ -392,6 +392,13 @@ void AP_InertialSensor_MPU9250::_read_data_transaction() { _spi->transaction((const uint8_t *)&tx, (uint8_t *)&rx, sizeof(rx)); + if (_drdy_pin) { + if (_drdy_pin->read() != 0) { + // data ready should have gone low after a read + printf("MPU9250: DRDY didn't go low\n"); + } + } + /* detect a bad SPI bus transaction by looking for all 14 bytes zero, or the wrong INT_STATUS register value. This is used to