You can chat about native SDK questions and issues here.

User avatar
By leofds
#87754 Hi, the i2c example code from ESP8266_RTOS_SDK\examples\peripherals\i2c is causing abort().
The example code has not been modified and I have already successfully tested other examples.
I don't have MPU6050 connected !

I made the git clone again from the repository and run the commands:
Code: Select allmake menuconfig
make -j4 flash monitor

Logs:

Code: Select allLeaving...
Hard resetting via RTS pin...
MONITOR
--- idf_monitor on COM8 74880 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 7168, room 16
tail 0
chksum 0x6d
load 0x3ffe8408, len 24, room 8
tail 0
chksum 0xe4
load 0x3ffe8420, len 3532, room 8
tail 4
chksum 0xc7
I (43) boot: ESP-IDF v3.2-493-g0b390d81 2nd stage bootloader
I (43) boot: compile time 08:53:03
I (43) qio_mode: Enabling default flash chip QIO
I (51) boot: SPI Speed      : 40MHz
I (57) boot: SPI Mode       : QIO
I (63) boot: SPI Flash Size : 2MB
I (70) boot: Partition Table:
I (75) boot: ## Label            Usage          Type ST Offset   Length
I (86) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (98) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (109) boot:  2 factory          factory app      00 00 00010000 000f0000
I (121) boot: End of partition table
I (128) esp_image: segment 0: paddr=0x00010010 vaddr=0x40210010 size=0x19690 (104080) map
0x40210010: _stext at ??:?

I (175) esp_image: segment 1: paddr=0x000296a8 vaddr=0x402296a0 size=0x04390 ( 17296) map
I (182) esp_image: segment 2: paddr=0x0002da40 vaddr=0x3ffe8000 size=0x003c8 (   968) load
I (187) esp_image: segment 3: paddr=0x0002de10 vaddr=0x40100000 size=0x00a50 (  2640) load
I (200) esp_image: segment 4: paddr=0x0002e868 vaddr=0x40100a50 size=0x04bb4 ( 19380) load
I (220) boot: Loaded app from partition at offset 0x10000
I (240) system_api: Base MAC address is not set, read default base MAC address from EFUSE
I (244) system_api: Base MAC address is not set, read default base MAC address from EFUSE
phy_version: 1163.0, 665d56c, Jun 24 2020, 10:00:08, RTOS new
I (311) phy_init: phy ver: 1163_0
I (313) reset_reason: RTC reset 2 wakeup 0 store 0, reason is 2
I (409) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
I (413) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x40211f1c
0x40211f1c: _esp_error_check_failed at C:/msys32/home/leonardo/esp/ESP8266_RTOS_SDK/components/freertos/port/esp8266/panic.c:206

file: "user_main.c" line 203
func: i2c_example_master_mpu6050_init
expression: i2c_example_master_mpu6050_write(i2c_num, PWR_MGMT_1, &cmd_data, 1)
abort() was called at PC 0x40211f1f on core 0
0x40211f1f: _esp_error_check_failed at C:/msys32/home/leonardo/esp/ESP8266_RTOS_SDK/components/freertos/port/esp8266/panic.c:207

Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x402191a2  PS      : 0x00000030  A0      : 0x402191a0  A1      : 0x3ffebb80
0x402191a2: abort at C:/msys32/home/leonardo/esp/ESP8266_RTOS_SDK/components/newlib/newlib/port/syscall.c:168 (discriminator 1)

0x402191a0: abort at C:/msys32/home/leonardo/esp/ESP8266_RTOS_SDK/components/newlib/newlib/port/syscall.c:168 (discriminator 1)

A2      : 0x00000000  A3      : 0x00000001  A4      : 0xffffffdb  A5      : 0x00000001
A6      : 0x00000000  A7      : 0x4022b524  A8      : 0x3ffe9670  A9      : 0x00000090
A10     : 0x4022c986  A11     : 0x00000020  A12     : 0x00000000  A13     : 0x00000000
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x0000001e  EXCCAUSE: 0x0000001d

Backtrace: 0x402191a2:0x3ffebb80 0x40211f22:0x3ffebb90 0x40213ae4:0x3ffebba0 0x40213c1c:0x3ffebbc0
0x402191a2: abort at C:/msys32/home/leonardo/esp/ESP8266_RTOS_SDK/components/newlib/newlib/port/syscall.c:168 (discriminator 1)

0x40211f22: _esp_error_check_failed at ??:?

0x40213ae4: i2c_example_master_mpu6050_init at C:/msys32/home/leonardo/esp/i2c/main/user_main.c:204

0x40213c1c: i2c_task_example at C:/msys32/home/leonardo/esp/i2c/main/user_main.c:226

I am using NodeMCU ESP8266 LoLin V3, I have already tested it with other cards and the result is the same.

Does anyone succeed in running this example from the current version ?
User avatar
By leofds
#87792 Solved. The abort() occurs because I don't have the MCU6050 connected.

The function i2c_example_master_mpu6050_write is called with macro ESP_ERROR_CHECK

ESP_ERROR_CHECK(i2c_example_master_mpu6050_write(i2c_num, PWR_MGMT_1, &cmd_data, 1));

This macro calls abort() function if the return value esp_err_t isn't ESP_OK.
I replaced ESP_ERROR_CHECK for ESP_ERROR_CHECK_WITHOUT_ABORT and the abort() didn't happen anymore.