Error while flashing ESP32 OTA

awr001c
Posts: 1
Joined: Sun Apr 07, 2019 10:25 pm

Error while flashing ESP32 OTA

Postby awr001c » Tue Apr 09, 2019 8:03 pm

ESP-IDF version
$ git describe --tags --dirty
v3.3-beta2-53-g79ca95ddf

Toolchain version: crosstool-ng-1.22.0-80-g6c4433a5

Hi,
I'm implementing the app which part is handling IR remote control. The only thing I need to do is to handle IR codes by ESP32 from remote control.
I used IRremote libary because it seemed to me the easiest way. It was, until it occured that I need to implement OTA flashing. Then I faced following problem:
...
Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed)
Core 1 register dump:
PC : 0x401641d4 PS : 0x00060034 A0 : 0x40085ba0 A1 : 0x3ffbf360
0x401641d4: MATCH_SPACE(int, int) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/IRremote/src/IRremote.cpp:106 (discriminator 1)
0x40085ba0: _xt_lowint1 at C:/msys32/home/Wojtek/esp/esp-idf/components/freertos/xtensa_vectors.S:1154

A2 : 0x00000001 A3 : 0x00000002 A4 : 0x3ff4201c A5 : 0x400979ec
0x400979ec: _frxt_int_enter at C:/msys32/home/Wojtek/esp/esp-idf/components/freertos/portasm.S:119

A6 : 0x3ff42008 A7 : 0x3ff42024 A8 : 0x8008ab8c A9 : 0x3ffbfc50
A10 : 0xe00a1000 A11 : 0x00000000 A12 : 0x00060021 A13 : 0x3ffb18f0
A14 : 0x00000001 A15 : 0x3ffb8058 SAR : 0x0000001c EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x4008f6a4 LEND : 0x4008f6d2 LCOUNT : 0x00000000
0x4008f6a4: memcpy at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xtensa/../../../../.././newlib/libc/machine/xtensa/memcpy.S:168
0x4008f6d2: memcpy at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xtensa/../../../../.././newlib/libc/machine/xtensa/memcpy.S:201

Core 1 was running in ISR context:
EPC1 : 0x400621d0 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x401641d4
0x401641d4: MATCH_SPACE(int, int) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/IRremote/src/IRremote.cpp:106 (discriminator 1)

ELF file SHA256: ad0bd0baad0bd0baad0bd0baad0bd0baad0bd0baad0bd0baad0bd0baad0bd0ba

Backtrace: 0x401641d4:0x3ffbf360 0x40085b9d:0x3ffbf380 0x400621cd:0x3ffb1930 0x4008afab:0x3ffb1950 0x4008afe2:0x3ffb1980 0x4008b081:0x3ffb19b0 0x4008b516:0x3ffb19d0 0x40086971:0x3ffb19f0 0x400869de:0
x3ffb1a10 0x40162795:0x3ffb1a30 0x401658de:0x3ffb1a50 0x40165b0d:0x3ffb1a70 0x40143374:0x3ffb1a90 0x401250ce:0x3ffb1ab0 0x40166c4e:0x3ffb1ad0 0x4016b37d:0x3ffb1b00 0x4016c249:0x3ffb1b40 0x4016d4aa:0x
3ffb1d30 0x40166e76:0x3ffb1f40 0x40143836:0x3ffb1f90 0x40123101:0x3ffb1fb0 0x40096a51:0x3ffb1fd0
0x401641d4: MATCH_SPACE(int, int) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/IRremote/src/IRremote.cpp:106 (discriminator 1)
0x40085b9d: _xt_lowint1 at C:/msys32/home/Wojtek/esp/esp-idf/components/freertos/xtensa_vectors.S:1154
0x4008afab: esp_rom_spiflash_read_status at C:/msys32/home/Wojtek/esp/esp-idf/components/spi_flash/spi_flash_rom_patch.c:412
0x4008afe2: esp_rom_spiflash_wait_idle at C:/msys32/home/Wojtek/esp/esp-idf/components/spi_flash/spi_flash_rom_patch.c:412
0x4008b081: esp_rom_spiflash_erase_sector_internal at C:/msys32/home/Wojtek/esp/esp-idf/components/spi_flash/spi_flash_rom_patch.c:412
0x4008b516: esp_rom_spiflash_erase_sector at C:/msys32/home/Wojtek/esp/esp-idf/components/spi_flash/spi_flash_rom_patch.c:450
0x40086971: spi_flash_erase_range at C:/msys32/home/Wojtek/esp/esp-idf/components/spi_flash/flash_ops.c:233
0x400869de: spi_flash_erase_sector at C:/msys32/home/Wojtek/esp/esp-idf/components/spi_flash/flash_ops.c:204
0x40162795: Printable::~Printable() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/Esp.cpp:325
(inlined by) IPAddress::~IPAddress() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/IPAddress.h:52
(inlined by) __static_initialization_and_destruction_0 at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/IPAddress.h:94
0x401658de: UpdateClass::_writeBuffer() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/Update/src/Updater.cpp:81
0x40165b0d: UpdateClass::write(unsigned char*, unsigned int) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/Update/src/Updater.cpp:81
0x40143374: std::_Function_handler<void (), setup()::{lambda()#4}>::_M_invoke(std::_Any_data const&) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/main/main.cpp:190
(inlined by) _M_invoke at c:\msys32\opt\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\5.2.0/functional:1871
0x401250ce: std::function<void ()>::operator()() const at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/FunctionalInterrupt.cpp:31
0x40166c4e: FunctionRequestHandler::upload(WebServer&, String, HTTPUpload&) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/WebServer.cpp:227
0x4016b37d: WebServer::_uploadWriteByte(unsigned char) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/Parsing.cpp:298
0x4016c249: WebServer::_parseForm(WiFiClient&, String, unsigned int) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/Parsing.cpp:401
0x4016d4aa: WebServer::_parseRequest(WiFiClient&) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/Parsing.cpp:199 (discriminator 3)
0x40166e76: WebServer::handleClient() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/WebServer.cpp:227
0x40143836: setup() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/main/main.cpp:223
0x40123101: loopTask(void*) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/main.cpp:22
0x40096a51: vPortTaskWrapper at C:/msys32/home/Wojtek/esp/esp-idf/components/freertos/port.c:355 (discriminator 1)
So I googled and read a lot of topics on this error. From what I understand, my problem is that there in an interrupt handling and the functions and data are not in IRAM/DRAM.
What I did then, was to add IRAM_ATTR and DRAM_ATTR to my code related to IRremote

Code: Select all

IRrecv IRAM_ATTR irrecv(IRRECV_PIN);
decode_results DRAM_ATTR results;
unsigned long DRAM_ATTR receivedIrCode;

void IRAM_ATTR handleIrCode() {
	if (irrecv.decode(&results)) {
		switch (results.value) {
		case 0xFF629D:
		case 0xFFA857:
		case 0xFF02FD:
		case 0xFF6897:
		case 0xFF9867:
		case 0xFFB04F:
		case 0xFF18E7:
		case 0xFF42BD:
		case 0xFF52AD:
			receivedIrCode = results.value;
			break;
		default:
			break;
		}
		irrecv.resume();
	}
}
According to the following topic https://www.esp32.com/viewtopic.php?t=7684, I also unchecked following options in make menuconfig
[ ] Place transmitting functions of SPI master into IRAM
[ ] Place SPI master ISR function into IRAM
[ ] Place transmitting functions of SPI slave into IRAM
[ ] Place SPI slave ISR function into IRAM

So, the next error while OTA flashing I got, was not in my code but in the IRremote lib rather.
So I tried to add IRAM_ATTR and DRAM_ATTR to functions and variables in the lib and remove errors one by one but eventually I gave up on the error:
...
Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed)
Core 1 register dump:
PC : 0x401641d4 PS : 0x00060034 A0 : 0x40085ba0 A1 : 0x3ffbf360
0x401641d4: Printable::~Printable() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/IRremote/src/ir_LG.cpp:77
(inlined by) IPAddress::~IPAddress() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/IPAddress.h:52
(inlined by) __static_initialization_and_destruction_0 at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/IPAddress.h:94
0x40085ba0: _xt_lowint1 at C:/msys32/home/Wojtek/esp/esp-idf/components/freertos/xtensa_vectors.S:1154
A2 : 0x00000001 A3 : 0x00000002 A4 : 0x00040000 A5 : 0x400979ec
0x400979ec: xQueueGenericReceive at C:/msys32/home/Wojtek/esp/esp-idf/components/freertos/queue.c:1996

A6 : 0x3ff42000 A7 : 0x700000bb A8 : 0x8008ab8c A9 : 0x3ffbfc50
A10 : 0xe00a1000 A11 : 0xb0000000 A12 : 0x00000000 A13 : 0x00000000
A14 : 0x3ff42000 A15 : 0x700000bb SAR : 0x0000001e EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x4008f6a4 LEND : 0x4008f6d2 LCOUNT : 0x00000000
0x4008f6a4: strcmp at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xtensa/../../../../.././newlib/libc/machine/xtensa/strcmp.S:487
0x4008f6d2: strcmp at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xtensa/../../../../.././newlib/libc/machine/xtensa/strcmp.S:534

Core 1 was running in ISR context:
EPC1 : 0x40062230 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x401641d4
0x401641d4: Printable::~Printable() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/IRremote/src/ir_LG.cpp:77
(inlined by) IPAddress::~IPAddress() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/IPAddress.h:52
(inlined by) __static_initialization_and_destruction_0 at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/IPAddress.h:94

ELF file SHA256: ad0bd0baad0bd0baad0bd0baad0bd0baad0bd0baad0bd0baad0bd0baad0bd0ba

Backtrace: 0x401641d4:0x3ffbf360 0x40085b9d:0x3ffbf380 0x4006222d:0x3ffb1950 0x4008afab:0x3ffb1970 0x4008b218:0x3ffb19a0 0x4008b509:0x3ffb19d0 0x40086971:0x3ffb19f0 0x400869de:0x3ffb1a10 0x40162795:0
x3ffb1a30 0x401658de:0x3ffb1a50 0x40165b0d:0x3ffb1a70 0x40143374:0x3ffb1a90 0x401250ce:0x3ffb1ab0 0x40166c4e:0x3ffb1ad0 0x4016b37d:0x3ffb1b00 0x4016c249:0x3ffb1b40 0x4016d4aa:0x3ffb1d30 0x40166e76:0x
3ffb1f40 0x40143836:0x3ffb1f90 0x40123101:0x3ffb1fb0 0x40096a51:0x3ffb1fd0
0x401641d4: Printable::~Printable() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/IRremote/src/ir_LG.cpp:77
(inlined by) IPAddress::~IPAddress() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/IPAddress.h:52
(inlined by) __static_initialization_and_destruction_0 at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/IPAddress.h:94
0x40085b9d: _xt_lowint1 at C:/msys32/home/Wojtek/esp/esp-idf/components/freertos/xtensa_vectors.S:1154
0x4008afab: spiWriteShortNL at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/esp32-hal-spi.c:543
0x4008b218: _xt_nmi at C:/msys32/home/Wojtek/esp/esp-idf/components/freertos/xtensa_vector_defaults.S:160
0x4008b509: esp_rom_spiflash_enable_write at C:/msys32/home/Wojtek/esp/esp-idf/components/spi_flash/spi_flash_rom_patch.c:412
0x40086971: spi_flash_erase_range at C:/msys32/home/Wojtek/esp/esp-idf/components/spi_flash/flash_ops.c:224
0x400869de: spi_flash_erase_range at C:/msys32/home/Wojtek/esp/esp-idf/components/spi_flash/flash_ops.c:211
0x40162795: Printable::~Printable() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/Esp.cpp:325
(inlined by) IPAddress::~IPAddress() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/IPAddress.h:52
(inlined by) __static_initialization_and_destruction_0 at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/IPAddress.h:94
0x401658de: WebServer::begin() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/WebServer.cpp:227
0x40165b0d: FunctionRequestHandler::canHandle(HTTPMethod, String) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/WebServer.cpp:227
0x40143374: std::_Function_handler<void (), setup()::{lambda()#4}>::_M_invoke(std::_Any_data const&) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/main/main.cpp:190
(inlined by) _M_invoke at c:\msys32\opt\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\5.2.0/functional:1871
0x401250ce: std::function<void ()>::operator()() const at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/FunctionalInterrupt.cpp:31
0x40166c4e: WebServer::handleClient() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/WebServer.cpp:227
0x4016b37d: WebServer::_parseArguments(String) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/Parsing.cpp:267 (discriminator 7)
0x4016c249: WebServer::_parseForm(WiFiClient&, String, unsigned int) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/Parsing.cpp:451
0x4016d4aa: WebServer::_parseRequest(WiFiClient&) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/Parsing.cpp:102
0x40166e76: Print::~Print() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/WebServer.cpp:227
(inlined by) Server::~Server() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/Server.h:25
(inlined by) WiFiServer::~WiFiServer() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WiFi/src/WiFiServer.h:39
(inlined by) WebServer::WebServer(int) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/libraries/WebServer/src/WebServer.cpp:77
0x40143836: setup() at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/main/main.cpp:223
0x40123101: loopTask(void*) at C:/msys32/home/Wojtek/esp/esp32_projects/RollingBlinds/components/arduino/cores/esp32/main.cpp:22
0x40096a51: xPortGetCoreID at C:/msys32/home/Wojtek/esp/esp-idf/components/freertos/include/freertos/portable.h:208
(inlined by) uxTaskResetEventItemValue at C:/msys32/home/Wojtek/esp/esp-idf/components/freertos/tasks.c:4586
...
I'm not sure but I think, that’s not the way I should proceed. To be honest I don't have any ideas how to move further...
I don't care about interrupts while OTA flashing so they can be disabled.
Could you please help me to find a solution? I'd like to mention that I do have also added LCD TFT SPI (ILI9341) support in my app, which also may cause the problem but I didn't see any direct symptoms yet.

thank you in advance,
Wojtek

Who is online

Users browsing this forum: engkhaledeisa, Google [Bot], Mattgo and 104 guests