Skip to content

[ESP32-s2] Crash when scanning I2C #5636

Closed
@TD-er

Description

@TD-er

Hardware:

Board: ?ESP32 Dev Module? ?node32? ?ttgo_lora?
Core Installation version: ?1.0.0? ?1.0.1-rc4? ?1.0.1? ?1.0.1-git? ?1.0.2? ?1.0.3?
IDE name: ?Arduino IDE? ?Platform.io? ?IDF component?
Flash Frequency: ?40Mhz?
PSRAM enabled: ?no? ?yes?
Upload Speed: ?115200?
Computer OS: ?Windows 10? ?Mac OSX? ?Ubuntu?

Description:

When scanning the I2C bus, the ESP32-S2 immediately crashes.

The crash suggests the pins are the same, but that's not how I set them.
The I2C pins are set via Wire.begin and not via the setPins call, since I have no explicit differences between ESP8266 and ESP32 code for I2C.

It crashes on line 1855: (i2c_master_stop)

i2c_err_t i2cWrite(i2c_t * i2c, uint16_t address, uint8_t* buff, uint16_t size, bool sendStop, uint16_t timeOutMillis){
esp_err_t ret = ESP_OK;
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (address << 1) | I2C_MASTER_WRITE, ACK_CHECK_EN);
if(size){
i2c_master_write(cmd, buff, size, ACK_CHECK_EN);
}
//if send stop?
i2c_master_stop(cmd);
ret = i2c_master_cmd_begin(i2c->num, cmd, timeOutMillis / portTICK_RATE_MS);
i2c_cmd_link_delete(cmd);
return ret;
}

The scanning procedure is as basic as it gets:
https://github.com/letscontrolit/ESPEasy/blob/a27b6a6fc1e50861b52c70bbf361f9ccc6c9587f/src/src/WebServer/I2C_Scanner.cpp#L305-L365

N.B. It crashes when scanning with and without any I2C device connected.
When connecting an I2C device, like an OLED display, it does work fine. So it is just the scanning which causes issues.

Debug Messages:

E (89928) i2c: i2c_set_pin(860): scl and sda gpio numbers are the same
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x4010641e  PS      : 0x00060f30  A0      : 0x80083080  A1      : 0x3ffd3290
A2      : 0x00000000  A3      : 0x00000002  A4      : 0x3ffc5e5a  A5      : 0x00000000  
A6      : 0x3ffd85f4  A7      : 0x00000032  A8      : 0x8010641e  A9      : 0x3ffd3250  
A10     : 0x00000000  A11     : 0x00000002  A12     : 0x00000900  A13     : 0x00000000
A14     : 0x00001800  A15     : 0x00000000  SAR     : 0x00000016  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000  LBEG    : 0x00000900  LEND    : 0x00000000  LCOUNT  : 0x40028855  


Backtrace:0x4010641b:0x3ffd32900x4008307d:0x3ffd32b0 0x40083191:0x3ffd32d0 0x400f12a5:0x3ffd32f0 0x40101553:0x3ffd3360 0x40194f45:0x3ffd33a0 0x4008b59e:0x3ffd33c0 0x4008d5be:0x3ffd3400 0x4008d6e7:0x3ffd3470 0x400cb4a6:0x3ffd34c0 0x400cb791:0x3ffd3500 0x400a0bfb:0x3ffd3540 0x4010843c:0x3ffd3560 
  #0  0x4010641b:0x3ffd32900 in i2cWrite at C:/Users/gijsn/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-i2c.c:1855




ELF file SHA256: 0000000000000000

Rebooting...
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40026ad0
SPIWP:0xee
mode:DOUT, clock div:1
load:0x3ffe6100,len:0x7c
load:0x4004c000,len:0x7e4
load:0x40050000,len:0x2598
entry 0x4004c15c

Metadata

Metadata

Assignees

Labels

Chip: ESP32-S2Issue is related to support of ESP32-S2 Chip

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions