MPU9250BasicAHRS.ino sample crashes



  • I tried to run the MPU9250BasicAHRS.ino sample, but it crashes. I have a M5Stack ESP32 GREY Development Kit with buildin IMU. On a secound device, the same code runs without problems. Does anyone have any idea why the problem occurs?
    I got following outputs on the serial console:

    13:43:57.119 -> ets Jun  8 2016 00:22:57
    13:43:57.119 -> 
    13:43:57.119 -> rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
    13:43:57.119 -> configsip: 0, SPIWP:0xee
    13:43:57.119 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    13:43:57.119 -> mode:DIO, clock div:1
    13:43:57.119 -> load:0x3fff0018,len:4
    13:43:57.119 -> load:0x3fff001c,len:1216
    13:43:57.119 -> ho 0 tail 12 room 4
    13:43:57.119 -> load:0x40078000,len:9720
    13:43:57.119 -> ho 0 tail 12 room 4
    13:43:57.119 -> load:0x40080400,len:6352
    13:43:57.119 -> entry 0x400806b8
    13:43:57.306 -> M5Stack initializing...OK
    13:43:58.703 -> MPU9250 I AM 19 I should be 71
    13:43:59.700 -> MPU9250 is online...
    13:44:00.531 -> x-axis self test: acceleration trim within : -0.1% of factory value
    13:44:00.531 -> y-axis self test: acceleration trim within : -1.3% of factory value
    13:44:00.531 -> z-axis self test: acceleration trim within : 1.1% of factory value
    13:44:00.531 -> x-axis self test: gyration trim within : -8.3% of factory value
    13:44:00.531 -> y-axis self test: gyration trim within : 0.7% of factory value
    13:44:00.531 -> z-axis self test: gyration trim within : 0.4% of factory value
    13:44:00.930 -> Guru Meditation Error: Core  1 panic'ed (IntegerDivideByZero). Exception was unhandled.
    13:44:00.930 -> Core 1 register dump:
    13:44:00.930 -> PC      : 0x400d47ce  PS      : 0x00060330  A0      : 0x800d1604  A1      : 0x3ffb1f30  
    13:44:00.930 -> A2      : 0x3ffb1f60  A3      : 0x3ffc01f0  A4      : 0x3ffc01fc  A5      : 0x00000000  
    13:44:00.930 -> A6      : 0x00000000  A7      : 0x00000000  A8      : 0x00000000  A9      : 0x00000000  
    13:44:00.930 -> A10     : 0x00000000  A11     : 0x00000002  A12     : 0x00000000  A13     : 0x00000002  
    13:44:00.930 -> A14     : 0x3ffb1f60  A15     : 0x00000000  SAR     : 0x0000001d  EXCCAUSE: 0x00000006  
    13:44:00.963 -> EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000  
    13:44:00.963 -> 
    13:44:00.963 -> Backtrace: 0x400d47ce:0x3ffb1f30 0x400d1601:0x3ffb1f90 0x400d9c4b:0x3ffb1fb0 0x40088c19:0x3ffb1fd0
    13:44:00.963 -> 
    13:44:00.963 -> Rebooting...
    

  • M5Stack

    Hi @steinoxyd as far as i'm aware the mpu9250 was replaced by MPU6886 in newer versions of M5Stack Grey. if you open your stack and look on the pcb you can see your revision number. https://docs.m5stack.com/#/en/core/gray

    I just saw this on the adafruit page "As of Oct 26, 2019 this product comes with a MPU6886+BMM150 9DoF sensor instead of the discontinued MPU9250"

    Try this code
    https://github.com/m5stack/M5StickC/blob/master/src/utility/MPU6886.h



  • Hi @steinoxyd ,
    I had the same issue which I got help with on the m5stack github before seeing this. I may as well direct you straight to it than repeating it fully here;
    https://github.com/m5stack/M5Stack/issues/194
    The issue is the 'IMU.calibrateMPU9250(IMU.gyroBias, IMU.accelBias);' which if commented out, the code will run.
    From the comment from @lukasmaximus I have not realised the probable reason for the issue.