sparkfun / SparkFun_MPU-9250-DMP_Arduino_Library

Arduino library for the MPU-9250 enabling its digital motion process (DMP) features.
Other
229 stars 151 forks source link

Mystical oddities with the MPU9250 and the library #53

Open brightproject opened 1 year ago

brightproject commented 1 year ago

Used stm32f401ccu6 BlackPill board from WeAct.. 252145709-9615b9e7-84cc-44e3-9a02-99425d882490 I also reduced the pull-up resistors from 10 kΩ to 4.7 kΩ. Looking ahead, I will say that this did not change anything in the work. About I2C connection here. Core for Arduino IDE here. Bought two bread-boards MPU9250 and began to look for libraries to work with accelerometers, gyroscopes and magnetometers. I tried the bolderflight library, but it constantly gave an error connecting to the serial port.

PS C:\Users\Admin> arduino-cli monitor -p COM6 -c baudrate=115200
Monitor port settings:
baudrate=115200
Connected to COM6! Press CTRL-C to exit.
Error initializing communication with IMU

252349472-36a15c5f-d3fc-4292-a03c-c7f974d8ce19 Also tried the asukiaaa library, but there is also a problem with the connection. In order to deal with the problem, I connected using the I2C bus analyzer and saw that the sensor gives a response of 0x70 to the "who-I-am" request. 252349151-2f6803a4-18d3-4ecb-9eee-02c19313a652

From this, I realized that my boards are fake, and there is no magnetometer on them. I was very frustrated that I could not try and use the MPU9250 boards for my navigation tasks - I wrote an angry letter to the seller from Aliexpress, but he did not even answer me ... What was my surprise when, having loaded the sketch of the SparkFan library, I saw the treasured readings of the accelerometer and gyroscope.

Accel: -0.01, 0.09, 1.01 g
Gyro: -4.57, 4.51, 1.65 dps
Mag: 0.00, 0.00, 0.00 uT
Time: 118769 ms

Accel: -0.02, 0.12, 1.01 g
Gyro: -4.70, 2.99, 2.01 dps
Mag: 0.00, 0.00, 0.00 uT
Time: 120776 ms

Accel: -0.02, 0.14, 1.01 g
Gyro: -4.45, 3.54, 2.01 dps
Mag: 0.00, 0.00, 0.00 uT
Time: 122785 ms

Accel: -0.04, 0.17, 1.00 g
Gyro: -4.76, 2.99, 2.01 dps
Mag: 0.00, 0.00, 0.00 uT
Time: 124796 ms

The magnetometer of course showed zeros. 252167195-e587a91c-4687-4fdf-b793-d44e798876fe I also tried uploading a sketch with a quaternion calculation, and it also worked, although I thought that to calculate the quaternion - you need data from a magnetometer.

I fiddled with countless firmware and library downloads for about three days. The next day, I demanded to upload the SparkFan sketch again to my stm32f401ccu6 board, and to my extravagance, the serial port did not give out any data. I decided to check the communication on the I2C bus - also silence. I thought maybe something happened to his PC overnight and rebooted. After the reboot, I got a BSOD and spent another three days trying to restore the work of a personal computer - the SSD broke (and I think this happened because of its 4-year work).

While I was restoring the PC, I tried to download the SparkFan sketch on my second computer (laptop), but it still did not work. I have already begun to think that perhaps it seemed to me that the MPU9250 board worked and gave out data, but the screenshots do not let me forget this. 252343495-0610fea0-949a-4ca4-95e9-1b9b227c5ab5 Now I'm working on a restored PC, but none of the libraries for the MPU9250 work. I don’t know what it was .... a miracle or what happened to the hardware (my STM32 microcontroller, MPU9250 board, STmicroelectronics core for Arduino or some other mysticism.) Can anyone give some advice/information on what happened? Commands are sent via the I2C bus from the microcontroller to the MPU9250, but there is no output to the serial port, as if the controller freezes. But I have already changed three microcontrollers, I also tried to run the code on the ESP32 ... the same thing. I remembered what I did before the SSD crashed, and it seems like I updated the core, but the branch itself does not consider that the problem is with the core and I2C.