SparkFun_MPU-9250-DMP_Arduino_Library icon indicating copy to clipboard operation
SparkFun_MPU-9250-DMP_Arduino_Library copied to clipboard

Reboot in SparkFunMPU9250-DMP.cpp at line 46

Open froussel opened this issue 2 years ago • 1 comments

Hello,

I use #include <U8g2lib.h> #include <Arduino.h> #include <SPI.h> #include <SparkFunMPU9250-DMP.h> #include <Chrono.h> #include "OneButton.h"

if I run screen u2g2lib, chrono, onebutton in first : no problem After ESP8266 wemos D1 mini reboot with result = mpu_init(&int_param); in SparkFunMPU9250-DMP.cpp

what is the solution please ?

SparkFunMPU9250-DMP.cpp

froussel avatar Feb 06 '22 20:02 froussel

`/* Go to your SparkFun library (this is usually Documents\Arduino\libraries\SparkFun_MPU-9250-DMP_Arduino_Library-master) navigate to src\util and edit the file inv_mpu.h Somewhere at the beginning of file, just below the line that says #define INV_MPU_H add the following line: #define min(X, Y) (((X) < (Y)) ? (X) : (Y)) and the library is good for ESP266 and ESP32 now with ESP8266 Wemos D1 Mini février 2022 MPU9250 ESP8266 VCC 3.3v GND GND SCL/SCLK D1 SCL SDA D2 SDA Ecran :UC1701x 5 LedA vers 3.3v 6 Vss GND 7 Vdd 3.3v 8 SCLK D5 SCK GPIO14 9 SDA D7 MOSI GPIO13 10 RS D4 dc GPIO 2 11 Reset D3 reset GPIO 0 12 CS D8 GPIO 15 / //#include <U8g2lib.h> <=== 1 #include <Arduino.h> #include <SPI.h> #include <SparkFunMPU9250-DMP.h> //U8G2_UC1701_MINI12864_F_4W_SW_SPI u8g2(U8G2_R2, / clock=D5*/ 14, /* data=D7*/ 13, /* cs=D8*/ 15, /* dc=D2*/ 2, /* reset=D3*/ 0 ); // ^=================== MPU9250_DMP imu; void compas1(void){ if (imu.begin() != INV_SUCCESS) { Serial.println("imu.begin() Failed!"); while (1) { Serial.println("Unable to communicate with MPU-9250"); Serial.println("Check connections, and try again."); Serial.println(); delay(5000); } } Serial.println("imu.begin() succeeded"); imu.dmpBegin(DMP_FEATURE_6X_LP_QUAT | // Enable 6-axis quat DMP_FEATURE_GYRO_CAL, // Use gyro calibration 10); // Set DMP FIFO rate to 10 Hz Serial.println("setup() completed"); compas2(); } void compas2(void){ byte boucle =0; while (boucle == 0) { delay(10); if (imu.fifoAvailable()) { if (imu.dmpUpdateFifo() == INV_SUCCESS) { delay(10); imu.computeEulerAngles(); Serial.println("R/P/Y: " + String(imu.roll) + ", " + String(imu.pitch) + ", " + String(imu.yaw)); } } } } void setup(void) { Serial.begin(115200); //u8g2.begin(); <==================== Wire.begin(); compas1(); } void loop(void) { delay(10); } https://github.com/sparkfun/SparkFun_MPU-9250-DMP_Arduino_Library

This sketch works but if we uncomment #include <U8g2lib.h> The esp8266 reboot In its library anymore and I think it's her who is at fault line if (imu.begin() != INV_SUCCESS) is the cause and if I go to the SparkFunMPU9250-DMP.h library it's on line 46 result = mpu_init(&int_param); which reboots mpu_init is in inv_mpu.c Then I don't know how to track Thanks for you help

froussel avatar Feb 08 '22 07:02 froussel

Extremely simple: I forgot #define <Wire.h>

froussel avatar Jan 02 '23 21:01 froussel