R131 - HC-SR04 crashes after some time

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

R131 - HC-SR04 crashes after some time

#1 Post by moelski » 24 Sep 2016, 07:39

Hi @all,

today I wanted to test the HC-SR04 (R131 from Git). But after some time the ESP crashes and I get a call stack:

Code: Select all

Fatal exception 0(IllegalInstructionCause):
epc1=0x40207910, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Exception (0):
epc1=0x40207910 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys 
sp: 3ffffc60 end: 3fffffb0 offset: 01a0

>>>stack>>>
3ffffe00:  40107620 3fff4054 3ffec77f 3ffeeb14  
3ffffe10:  ffffffff 00000020 3ffffed0 00000016  
3ffffe20:  3ffeea88 3ffee99c 3ffef0d0 00000022  
3ffffe30:  3fffc200 401075e8 3fffc258 4000050c  
3ffffe40:  4000439e 00000030 00000016 ffffffff  
3ffffe50:  60000200 00000001 60000204 80000000  
3ffffe60:  20000000 3fff5a00 80000000 203fc180  
3ffffe70:  00000000 3feffe00 fc70ffff 3fff5a04  
3ffffe80:  00000174 003fc180 3fff20cc 00000030  
3ffffe90:  3ffef720 3fff406c 00000000 4023060c  
3ffffea0:  00000000 04d6ce82 40230663 3fff406c  
3ffffeb0:  3fff4054 ffffffce 00000000 ffffffff  
3ffffec0:  40000f3d 00000023 00000000 3fffd9d0  
3ffffed0:  00000000 04310606 00640100 0000004c  
3ffffee0:  3ffec730 000000e9 3ffec74c 3ffec724  
3ffffef0:  3ffec752 3ffec730 3ffec73f 00000000  
3fffff00:  40243c68 00000000 0000007d 401004d8  
3fffff10:  3fff1fe8 00000175 00000175 40107a78  
3fffff20:  3fff3604 3fff3600 04d729da 40243bc9  
3fffff30:  00000000 400042db 00000000 3fff20cc  
3fffff40:  40004b31 3fff587c 000002f4 003fc000  
3fffff50:  4010605a 00000d6f 3ffee7c0 40107abc  
3fffff60:  40227cdd 3ffee7c0 00000d6f 3fffdad0  
3fffff70:  3fff587c 00001000 4022814f 0000010f  
3fffff80:  402289c3 40228a9a 60000600 3ffee7c0  
3fffff90:  00000000 00000000 40000f65 3fffdab0  
3fffffa0:  00000000 00001927 3fffdab0 40000f49  
<<<stack<<<
I used the Exception Decoder to get more details:

Code: Select all

Decoding 23 results
0x40207910: Plugin_013_interrupt() at C:\Users\Dominik\Desktop\Peter\ESPEasy/Misc.ino line 702
0x40207910: Plugin_013_interrupt() at C:\Users\Dominik\Desktop\Peter\ESPEasy/Misc.ino line 702
0x40107620: interrupt_handler at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_digital.c line 119
0x401075e8: interrupt_handler at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_digital.c line 113
0x4023060c: ieee80211_parse_wmeparams at ?? line ?
0x40230663: ieee80211_parse_wmeparams at ?? line ?
0x40243c68: tcpip_tcp_timer at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/timers.c line 81
0x401004d8: malloc at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1664
0x40107a78: pvPortMalloc at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 13
0x40243bc9: sys_timeout at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/timers.c line 296
0x4010605a: spi_flash_read at ?? line ?
0x40107abc: pvPortZalloc at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 33
0x40227cdd: pm_set_sleep_time at ?? line ?
0x4022814f: pm_get_sleep_type at ?? line ?
0x402289c3: LightSleepWakedCbSetFunc at ?? line ?
0x40228a9a: LightSleepWakedCbSetFunc at ?? line ?
There must be something wrong in the first line of the result (Plugin_013_interrupt is not in Misc.ino ;) ). Anyway it seems to me that there are possible problems because of disabling the interrupts :?:

I use SPIFFS but at that moment of the crash nothing is reading or writing from SPIFFS (only reading the sensor and send some MQTT data).

Any ideas how to fix this? I can do a test with R120 and without SPIFFS if it helps finding the bug.

Greetings
Dominik
regards
Dominik

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: R131 - HC-SR04 crashes after some time

#2 Post by moelski » 24 Sep 2016, 08:55

Hi again ...

Some additional tests ... R120 without SPIFFS works for 30 minutes without a crash. So that could be ok.
But using R131 without SPIFFS results in a new crash:

Code: Select all

Exception (0):
epc1=0x40202fc0 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys 
sp: 3ffffc60 end: 3fffffb0 offset: 01a0

>>>stack>>>
3ffffe00:  40107620 3fff4034 3ffecb23 3ffee874  
3ffffe10:  ffffffff 00000020 3ffffed0 00000016  
3ffffe20:  3ffee7e8 3ffee6fc 3ffeee30 00000022  
3ffffe30:  3fffc200 401075e8 3fffc258 4000050c  
3ffffe40:  400043a3 00000030 00000016 ffffffff  
3ffffe50:  60000200 00000008 7c397c38 80000000  
3ffffe60:  20000000 3fff4dc0 80000000 203fc180  
3ffffe70:  00000000 3feffe00 fc70ffff 3fff4dc4  
3ffffe80:  00000174 003fc180 3fff1e14 00000030  
3ffffe90:  00000000 00000000 0000001f 40105af5  
3ffffea0:  4000050c 04d473ac 4022a36f 3fff404c  
3ffffeb0:  40000f83 00000030 0000000d ffffffff  
3ffffec0:  40000f3d 00000023 00000000 3fffd9d0  
3ffffed0:  00000000 00000000 00000000 fffffffe  
3ffffee0:  ffffffff 3fffc6fc 00000001 3fffdab0  
3ffffef0:  00000000 3fffdad0 3fff1e14 00000000  
3fffff00:  4023d948 00000000 0000007d 401004d8  
3fffff10:  3fff1d30 000000ea 000000ea 40107a78  
3fffff20:  3fff333c 3fff3338 04d4be42 4023d8a9  
3fffff30:  00000000 400042db 00000000 3fff1e14  
3fffff40:  40004b31 3fff4c24 000002f4 003fc000  
3fffff50:  4010605a 00001449 3ffee520 40107abc  
3fffff60:  402219e5 3ffee520 00001449 3fffdad0  
3fffff70:  3fff4c24 00001000 40221e57 00000110  
3fffff80:  402226cb 402227a2 60000600 3ffee520  
3fffff90:  00000000 00000000 40000f65 3fffdab0  
3fffffa0:  00000000 00002001 3fffdab0 40000f49  
<<<stack<<<

Code: Select all

Decoding 24 results
0x40202fc0: Plugin_013_interrupt() at C:\Users\Dominik\Desktop\Peter\ESPEasy/Misc.ino line 702
0x40107620: interrupt_handler at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_digital.c line 119
0x401075e8: interrupt_handler at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_digital.c line 113
0x40105af5: ets_timer_disarm at ?? line ?
0x4022a36f: ieee80211_parse_wmeparams at ?? line ?
0x4023d948: tcpip_tcp_timer at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/timers.c line 81
0x401004d8: malloc at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1664
0x40107a78: pvPortMalloc at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 13
0x4023d8a9: sys_timeout at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/timers.c line 296
0x4010605a: spi_flash_read at ?? line ?
0x40107abc: pvPortZalloc at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 33
0x402219e5: pm_set_sleep_time at ?? line ?
0x40221e57: pm_get_sleep_type at ?? line ?
0x402226cb: LightSleepWakedCbSetFunc at ?? line ?
0x402227a2: LightSleepWakedCbSetFunc at ?? line ?
So this is not related to SPIFFS. But maybe a bug in R131 ?
regards
Dominik

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: R131 - HC-SR04 crashes after some time

#3 Post by moelski » 24 Sep 2016, 08:59

Ok a new test with R120 ... Now I got a crash here, too (SPIFFS disabled):

Code: Select all

Fatal exception 0(IllegalInstructionCause):
epc1=0x40203178, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Exception (0):
epc1=0x40203178 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: sys 
sp: 3ffffc60 end: 3fffffb0 offset: 01a0

>>>stack>>>
3ffffe00:  40107618 3fff4764 3ffed103 3ffeee54  
3ffffe10:  ffffffff 00000020 3ffffed0 00000016  
3ffffe20:  3ffeedc8 3ffeecdc 3ffef410 00000022  
3ffffe30:  3fffc200 401075e0 3fffc258 4000050c  
3ffffe40:  4000437d 00000030 00000016 ffffffff  
3ffffe50:  60000200 00000008 00022700 80000000  
3ffffe60:  20000000 3fff5518 80000000 203fc240  
3ffffe70:  80000000 3feffe00 fc70ffff 3fff551c  
3ffffe80:  000000b4 003fc240 3fff2548 00000030  
3ffffe90:  3ffefa60 3fff477c 00000000 40231fc8  
3ffffea0:  00000000 00fe6778 4023201f 3fff477c  
3ffffeb0:  3fff4764 ffffffd1 00000000 3fffd9d0  
3ffffec0:  00000000 00000000 00000000 fffffffe  
3ffffed0:  00003354 00310606 00640100 0000004c  
3ffffee0:  3ffed0b4 000000e9 3ffed0d0 3fff502c  
3ffffef0:  00000000 00000000 3fff3dc4 00000000  
3fffff00:  40106c04 00000000 00000064 401004d8  
3fffff10:  40106024 00ff1da5 3ffea694 00000000  
3fffff20:  3ffefa60 3ffea694 00fe8b79 40245581  
3fffff30:  00000000 400042db 00000000 3fff2548  
3fffff40:  40004b31 3fff52dc 000002f4 003fc000  
3fffff50:  40106446 00001190 3ffeeb00 40107abc  
3fffff60:  40229689 3ffeeb00 00001190 3fffdad0  
3fffff70:  3fff52dc 00001000 40229afb 000000f5  
3fffff80:  4022a36f 4022a446 60000600 3ffeeb00  
3fffff90:  00000000 00000000 40000f65 3fffdab0  
3fffffa0:  00000000 00001d48 3fffdab0 40000f49  
<<<stack<<<
Decoded Stack trace:

Code: Select all

Decoding 22 results
0x40203178: Plugin_013_interrupt() at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ArduinoJson/include/ArduinoJson/Internals/../JsonBuffer.hpp line 119 (discriminator 3)
0x40203178: Plugin_013_interrupt() at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ArduinoJson/include/ArduinoJson/Internals/../JsonBuffer.hpp line 119 (discriminator 3)
0x40107618: interrupt_handler at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_digital.c line 119
0x401075e0: interrupt_handler at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_digital.c line 113
0x40231fc8: ieee80211_parse_wmeparams at ?? line ?
0x4023201f: ieee80211_parse_wmeparams at ?? line ?
0x40106c04: igmp_timer at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/timers.c line 217
0x401004d8: malloc at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1664
0x40106024: ets_timer_arm_new at ?? line ?
0x40245581: sys_timeout at /Users/igrokhotkov/espressif/arduino/tools/sdk/lwip/src/core/timers.c line 296
0x40106446: spi_flash_read at ?? line ?
0x40107abc: pvPortZalloc at C:\Users\Dominik\Desktop\arduino-1.6.11\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 33
0x40229689: pm_set_sleep_time at ?? line ?
0x40229afb: pm_get_sleep_type at ?? line ?
0x4022a36f: LightSleepWakedCbSetFunc at ?? line ?
0x4022a446: LightSleepWakedCbSetFunc at ?? line ?
Hape anyone can help to fix this.

Dominik
regards
Dominik

Martinus

Re: R131 - HC-SR04 crashes after some time

#4 Post by Martinus » 24 Sep 2016, 10:55

This evil behavior seems to be caused by ISR handlers not being run from instruction RAM cache. Although this plugin has worked without issues with older ESP Arduino cores, i've seen similar behavior during development of the RF433 plugin. I've run some tests on the HCSR04 and it looks like R132 fixes the issue.

(and then we face new development challenges of keeping iram cache within its limitations, but all seems to fit right now...)

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: R131 - HC-SR04 crashes after some time

#5 Post by moelski » 24 Sep 2016, 11:11

Hi,

Thx for the really quick fix.
I will give it a try later.

Dominik
regards
Dominik

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: R131 - HC-SR04 crashes after some time

#6 Post by moelski » 24 Sep 2016, 13:07

Hi !

Just a small feedback ... Until now it works really nice.
No more crashes :)

Thx a lot for your support !

Dominik
regards
Dominik

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 24 guests