While trying to use the library example Basic_SPI, with Teensy 4.0 and a generic MPU9250 board, I encountered initialization errors on IMU.begin(). The errors produced return codes of -5 & -8 .
This was resolved by adding delays in two places in MPU9250.cpp:
I do not know if this could be a permanent solution, but it worked for me without affecting sensor throughput as it is only in initialization as far as I can tell.
delay(2); in the beginning of MPU9250::writeRegister(uint8_t subAddress, uint8_t data)
before: _spi->beginTransaction(SPISettings(SPI_LS_CLOCK, MSBFIRST, SPI_MODE3));
delay(1); in the beginning of int MPU9250::whoAmI()
before: if (readRegisters(WHO_AM_I, 1, _buffer) < 0)
I am posting this in Issues in the hope that it will help someone else running across this or a similar issue.
Thanks for a great library!
While trying to use the library example Basic_SPI, with Teensy 4.0 and a generic MPU9250 board, I encountered initialization errors on IMU.begin(). The errors produced return codes of -5 & -8 . This was resolved by adding delays in two places in MPU9250.cpp: I do not know if this could be a permanent solution, but it worked for me without affecting sensor throughput as it is only in initialization as far as I can tell.
before: if (readRegisters(WHO_AM_I, 1, _buffer) < 0)
I am posting this in Issues in the hope that it will help someone else running across this or a similar issue. Thanks for a great library!