diff --git a/src/platforms/posix/drivers/gyrosim/gyrosim.cpp b/src/platforms/posix/drivers/gyrosim/gyrosim.cpp index d9449116db..3722b1532d 100644 --- a/src/platforms/posix/drivers/gyrosim/gyrosim.cpp +++ b/src/platforms/posix/drivers/gyrosim/gyrosim.cpp @@ -506,8 +506,11 @@ GYROSIM::transfer(uint8_t *send, uint8_t *recv, unsigned len) // FIXME - not sure what interrupt status should be recv[1] = 0; + // skip cmd and status bytes - sim->getMPUReport(&recv[2], len - 2); + if (len > 2) { + sim->getMPUReport(&recv[2], len - 2); + } } else if (cmd & DIR_READ) { PX4_DEBUG("Reading %u bytes from register %u", len - 1, reg);