bolderflight / invensense-imu

Arduino and CMake library for communicating with the InvenSense MPU-6500, MPU-9250 and MPU-9255 nine-axis IMUs.
MIT License
497 stars 210 forks source link

Library not working on stm32 blackpill #93

Closed peteole closed 2 years ago

peteole commented 3 years ago

Hi, I do have the following issue: I am using this library on platformio with the arduino framework for an stm32 blue pill. There it works perfectly (if you are interested in the code you can find it here: https://github.com/peteole/telemtryFirmware/tree/master/src) However when uploading the exact same code on an stm32 black pill (only the platformio.ini changed to the blackpill) the sensor always reads zeros for both acceleration and gyro. An I2C-scan reveals the same addresses as on my blue pill and the pressure sensor is working perfectly as well. This is the same with another instance of the gy-91 sensor so the chance of a hardware failure can be considered small. Also no error of any kind is thrown. Any idea what's going on?

flybrianfly commented 3 years ago

Maybe the people who wrote the core for the Black Pill didn't properly implement an I2C repeated start? You could try changing the 'false' on this line to 'true': https://github.com/bolderflight/mpu9250-arduino/blob/main/src/mpu9250.cpp#L440

If that fixes it, I would reach out to the Black Pill core developers to let them know.