psiphi75 / esp-mpu9250

MPU9250 driver for the ESP8266 and the ESP32
Apache License 2.0
34 stars 18 forks source link

Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled. #11

Open NiopTres opened 1 year ago

NiopTres commented 1 year ago

Having issues with the code. At first I had some issues with the i2c part of the code ( Changed the following in i2c-easy.c:

ESP_ERROR_CHECK(i2c_param_config(i2c_master_port, &conf)); ESP_ERROR_CHECK(i2c_driver_install(i2c_master_port, conf.mode));

I also found that at least in the newest version of the Esp8266 SDK i downloaded, the i2c.c file does not use ".master.clk_speed" as part of the "i2c_config_t" struct's file... I tried adding some code back into it, but that may be part of the issue. It did help compile. But I do not believe that should have caused many issues

) . I am fairly new to dealing with ESP coding and flashing, i mostly dealt with Arduino boards and Arduino IDE for projects. But given my current project requires this ESP with MPU module for testing (we plan on switching to the newer non deprecated 10 DOF circuits), i am learning ESP.

The issue is now that I am compiling and flashing the code as said in the readme... I am getting the error as seen in the title, the debug looks the following in the msys32 Mingw32 :


$ make monitor
Toolchain path: /c/Users/juanj/OneDrive/Documents/Javeriana/SEMILLERO_IPS/esp-mpu9250-master/esp-mpu9250-master/\esp\xtensa-lx106-elf\bin/xtensa-lx106-elf-gcc
Toolchain version: esp-2020r3-49-gd5524c1
Compiler version: 8.4.0
Python requirements from C:/esp/ESP8266_RTOS_SDK/requirements.txt are satisfied.
MONITOR
--- idf_monitor on COM3 230400 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
 �  ��� � �    �� � ������ �  ����� � ��� � ��� �� ���� �  �  ��� �   � �      � ���� ������� ������ � �� � �  � �� �� � � �����   ��� �  ��� �
  ���� ��  � ���� ����  ������ �� � �  � �� �� � � �����    � �  ��� �   ���� ��� � ���� �������� ������ �� � �  � �� � ��� � � �����   �� � ���   �
�
I (44) boot: ESP-IDF v3.4-79-gaf0cdc36-dirty 2nd stage bootloader
I (44) boot: compile time 00:41:42
I (44) boot: SPI Speed      : 40MHz
I (46) boot: SPI Mode       : DIO
I (48) boot: SPI Flash Size : 2MB
I (50) boot: Partition Table:
I (52) boot: ## Label            Usage          Type ST Offset   Length
I (55) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (59) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (63) boot:  2 factory          factory app      00 00 00010000 000f0000
I (66) boot: End of partition table
I (68) esp_image: segment 0: paddr=0x00010010 vaddr=0x40210010 size=0x21ad8 (137944) map
0x40210010: _stext at ??:?

I (131) esp_image: segment 1: paddr=0x00031af0 vaddr=0x40231ae8 size=0x06ed4 ( 28372) map
I (144) esp_image: segment 2: paddr=0x000389cc vaddr=0x3ffe8000 size=0x0083c (  2108) load
I (145) esp_image: segment 3: paddr=0x00039210 vaddr=0x40100000 size=0x00080 (   128) load
I (147) esp_image: segment 4: paddr=0x00039298 vaddr=0x40100080 size=0x049a4 ( 18852) load
I (159) boot: Loaded app from partition at offset 0x10000
D (168) phy_init: loading PHY init data from application binary
D (176) nvs: nvs_open_from_partition backup_mac 0
D (178) nvs: nvs_get_str_or_blob backup_mac_data
D (181) nvs: nvs_close 1
D (182) system_api: Load MAC from NVS error=0
D (184) reset_reason: RTC reset 2 wakeup 0 store 4, reason is 2
D (186) wdt: Enable task watch dog panic, panic time parameter is 11
D (188) wdt: task watch dog trigger time parameter is 15
I (191) mpu9250: Initializating MPU9250
I (292) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 1| Pullup: 0| Pulldown: 0| Intr:0
I (294) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 1| Pullup: 0| Pulldown: 0| Intr:0
Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x4000df64  PS      : 0x00000030  A0      : 0x402270a8  A1      : 0x3ffec020
0x402270a8: i2c_param_config at C:/esp/ESP8266_RTOS_SDK/components/esp8266/driver/i2c.c:274

A2      : 0x00000000  A3      : 0x3ffec040  A4      : 0x0000001c  A5      : 0x00000000
A6      : 0x00000000  A7      : 0x00000004  A8      : 0x3ffec050  A9      : 0x00000090
A10     : 0x0000004f  A11     : 0x00000020  A12     : 0x3ffec040  A13     : 0x3ffe9784
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x0000001b  EXCCAUSE: 0x0000001d

Backtrace: 0x4000df64:0x3ffec020 0x402270a8:0x3ffec020 0x40214b9b:0x3ffec040 0x40214584:0x3ffec070 0x4021393f:0x3ffec080 0x40213aac:0x3ffec110 0x402270a8:0x3ffec120 0x40104bc8:0x3ffec140 0x402
270a8:0x3ffec140
0x402270a8: i2c_param_config at C:/esp/ESP8266_RTOS_SDK/components/esp8266/driver/i2c.c:274

0x40214b9b: i2c_master_init at C:/Users/juanj/OneDrive/Documents/Javeriana/SEMILLERO_IPS/esp-mpu9250-master/esp-mpu9250-master/components/mpu9250/i2c-easy.c:59

0x40214584: i2c_mpu9250_init at C:/Users/juanj/OneDrive/Documents/Javeriana/SEMILLERO_IPS/esp-mpu9250-master/esp-mpu9250-master/components/mpu9250/mpu9250.c:47

0x4021393f: run_imu at C:/Users/juanj/OneDrive/Documents/Javeriana/SEMILLERO_IPS/esp-mpu9250-master/esp-mpu9250-master/main/main.c:90

0x40213aac: app_main at C:/Users/juanj/OneDrive/Documents/Javeriana/SEMILLERO_IPS/esp-mpu9250-master/esp-mpu9250-master/main/main.c:147

0x402270a8: i2c_param_config at C:/esp/ESP8266_RTOS_SDK/components/esp8266/driver/i2c.c:274

0x402270a8: i2c_param_config at C:/esp/ESP8266_RTOS_SDK/components/esp8266/driver/i2c.c:274

怘� ��═~ �f��   x ��x���═~ ��ff~fx�� ����` ���`fx���x�����怘�~═x` �fxfx`f������══x  ═ ��     � �f�� �x��x� ����� �� ���`ff�� 怘�═���f~�  f�怘����══x  �xx�xf═
� �f�� x`� �����  ���`ff�� 怘�═���f~�  f��f������══x  �xx�xf═ � �f�� �x`�� �����  ���`ff�� ��x怘�═���f~�  �═�����f~�  �═�ť��UUPR�B�u�
                                                                                                                                     �U�**P�+U���T�T�UR��
U���Ԫ��Z�(UZ��UE��UU��UU�V�Z�UX��i�UPQK�KU��U��TUU��UU�V�ZUTU�UT���
                                                                   �UT�UU�TU�U��T�*��Z
                                                                                      UTU+UP���
                                                                                               I�UUU�TU�U��T�*��Z
U���Ԫ��Z�(UZ��UE��UU��UU�V�Z�UX��i�UPQK�KU��U��TUU��UU�V�ZUTU�UT���                                              UT��Z�UU��UUJU�TU�U��T*U���ZQ���
                                                                   �UT�UU�TU�U��T�*��Z
                                                                                      UTU+UP���
                                                                                               I�UUU�TU�U��T�*��Z
                                                                                                                 UT��Z�UU��UUJU�TU�U��T*U���ZQ�����(*RUZ��U��TUU�Q�U�V�Z�
�T��(�������UP�����.�U�]UZJP�UV����UE��UU�Q�U�j���Q��P�����������������Q�Q�Q�QQE�U�TU�U��TE*��Z
                                                                                               �
�ծժ
�ծժ����U)���
   ����U)���������Q
QQUQ�QQ��U�TU�U��T�*��Z
QQUQ�QQ��U�TU�U��T�*��Z
                       ��URkZ�����R�Ze,P��Q�QQQ�QQQEQ��U��TUU�QU�V�Z�+��P�K��V�ZTT�UU�TU�U��TE*U-�UV���VU�ZQ
                                                                                                            ��T�Q(Q�TQ��T�QTU�TQ�U��\�(�(Jյ�*U(JU�����UUPJUU�լ��V���VU�Z�
                                                                                                                                                                         ��T�Q(Q��(
��T�QTU��Ũ����UJTQ�Y�UB�X��U奢�UUPJ�U��X��V���VU�ZU
                                                   ��T�Q(Q�VR��T�Q���Q�U��\QU
Q(U��B��T��UE��UU��JUU-�U�V���VU�ZU
                                   ��T�Q(Q�UQ��T�QT�QQ����Q(QQQ(���B��T��UE��UU��J�U-�U�V���VU�Z�
                                                                                                 ��T�Q(Q�UY��T�QT�Q�����Q(�(�T�Y�*��T��U奢�UUPJUU���Z�TJPXUk��T������]UZJP��Q��U�RQ�Q�ծժ
��u�UV�TUPժ
           ���U�E,TU���������D (178) nvs: nvs_open_from_partition backup_mac 0```

And then it repeats infinitely. Honestly, I do not know what could be causing this. Perhaps the changes to the i2c.c program inside the SDK?
psiphi75 commented 1 year ago

Strange. I haven't used this library in a long time, so it's likely out of date and may not behave well with the latest ESP IDF.

NiopTres commented 1 year ago

Any way to know how to fix it or find out how to get it to work again?

The i2c.c files where the error appears looks like this

`esp_err_t i2c_param_config(i2c_port_t i2c_num, const i2c_config_t *i2c_conf) { I2C_CHECK((i2c_num >= 0) && (i2c_num < I2C_NUM_MAX), I2C_NUM_ERROR_STR, ESP_ERR_INVALID_ARG); I2C_CHECK(i2c_conf != NULL, I2C_ADDR_ERROR_STR, ESP_ERR_INVALID_ARG); I2C_CHECK(i2c_conf->mode < I2C_MODE_MAX, I2C_MODE_ERR_STR, ESP_ERR_INVALID_ARG);

esp_err_t ret = i2c_set_pin(i2c_num, i2c_conf->sda_io_num, i2c_conf->scl_io_num,
                            i2c_conf->sda_pullup_en, i2c_conf->scl_pullup_en, i2c_conf->mode);

if (ret != ESP_OK) {
    return ret;
}

memcpy((i2c_config_t *)(i2c_config[i2c_num]), (i2c_config_t *)i2c_conf, sizeof(i2c_config_t));
return ESP_OK;

}`

And the change i made to i2c.h so it would compile looks like this


    i2c_mode_t mode;              /*!< I2C mode */
    gpio_num_t sda_io_num;        /*!< GPIO number for I2C sda signal */
    gpio_pullup_t sda_pullup_en;  /*!< Internal GPIO pull mode for I2C sda signal*/
    gpio_num_t scl_io_num;        /*!< GPIO number for I2C scl signal */
    gpio_pullup_t scl_pullup_en;  /*!< Internal GPIO pull mode for I2C scl signal*/
    uint32_t clk_stretch_tick;    /*!< Clock Stretch time, depending on CPU frequency*/
/* new lines added to file */
    union {
        struct {
            uint32_t clk_speed;     /*!< I2C clock frequency for master mode, (no higher than 1MHz for now) */
        } master;
        struct {
            uint8_t addr_10bit_en;  /*!< I2C 10bit address mode enable for slave mode */
            uint16_t slave_addr;    /*!< I2C address for slave mode */
        } slave;

    };
/* end of new lines */
} i2c_config_t;```

Maybe you still have an older version of the i2c files from the IDF that could give an idea to what could be different?

Or maybe do you know of any other more up to date IDF library for the ESP and MPU combo?
psiphi75 commented 1 year ago

Sorry, I can't help. The only think I suggest is to put println statements everywhere and see where it crashes.

psiphi75 commented 1 year ago

The repository has been updated to run on ESP IDF 5.1. It has been tested on the ESP32, I still need to test it on the ESP8266.