Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As soon as I try to connect the webbrowser I got the following Exception (29) #1831

Closed
gernst48 opened this issue Jul 21, 2019 · 13 comments
Closed

Comments

@gernst48
Copy link

As soon as I try to connect the webbrowser I got the following Exception (29):


hardware.h configuration:

// Info
#define MANUFACTURER        "NODEMCU"
#define DEVICE              "LOLIN_EG_POWER"

// Buttons
#define BUTTON1_PIN         0
#define BUTTON1_MODE        BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH | BUTTON_SET_PULLUP
#define BUTTON1_RELAY       1

// Hidden button will enter AP mode if dblclick and reset the device when long-long-clicked
#define RELAY1_PIN          12
#define RELAY1_TYPE         RELAY_TYPE_NORMAL

// Light
#define LED1_PIN            2
#define LED1_PIN_INVERSE    1

// A bit of I2C
#define I2C_SDA_PIN         4
#define I2C_SCL_PIN         5

// BMX280 Environment sensor
#define BMX280_SUPPORT		1

// Energy definitions
#define SENSOR_ENERGY_UNITS    ENERGY_KWH   // Energy units (ENERGY_JOULES | ENERGY_KWH)
#define SENSOR_POWER_UNITS     POWER_WATTS  // Power units (POWER_WATTS | POWER_KILOWATTS)

// ADS1x15 Energy monitor
#define EMON_ADS1X15_SUPPORT   1
#define EMON_MAX_SAMPLES       1000  // Max number of samples to get
#define EMON_MAX_TIME          250   // Max time in ms to sample
#define EMON_FILTER_SPEED      512   // Mobile average filter speed
#define EMON_REFERENCE_VOLTAGE 3.3   // Reference voltage of the ADC
#define EMON_MAINS_VOLTAGE     230   // Mains voltage
#define EMON_CURRENT_RATIO     30    // Current ratio in the clamp (30A/1V)
#define EMON_REPORT_CURRENT    1     // Report current
#define EMON_REPORT_POWER      1     // Report power
#define EMON_REPORT_ENERGY     1     // Report energy

Serial terminal output:

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

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09826c6d
~ld
[000449]

---8<-------

[000449] [MAIN] ESPURNA 1.13.6-dev
[000449] [MAIN] xose.perez@gmail.com
[000449] [MAIN] http://tinkerman.cat

[000450] [MAIN] CPU chip ID: 0x5B8CCF
[000453] [MAIN] CPU frequency: 80 MHz
[000456] [MAIN] SDK version: 1.5.3(aec24ac9)
[000460] [MAIN] Core version: 2.3.0
[000463] [MAIN] Core revision: 9826c6d
[000467] [MAIN] Build time: 1563724357
[000470]
[000471] [MAIN] Flash chip ID: 0x1640EF
[000474] [MAIN] Flash speed: 40000000 Hz
[000478] [MAIN] Flash mode: DOUT
[000481]
[000482] [MAIN] Flash size (CHIP) : 4194304 bytes / 1024 sectors ( 0 to 1023)
[000489] [MAIN] Flash size (SDK) : 4194304 bytes / 1024 sectors ( 0 to 1023)
[000496] [MAIN] Reserved : 4096 bytes / 1 sectors ( 0 to 0)
[000503] [MAIN] Firmware size : 502016 bytes / 123 sectors ( 1 to 123)
[000511] [MAIN] Max OTA size : 2637824 bytes / 644 sectors ( 124 to 767)
[000518] [MAIN] SPIFFS size : 1015808 bytes / 248 sectors ( 768 to 1015)
[000525] [MAIN] EEPROM size : 16384 bytes / 4 sectors (1016 to 1019)
[000532] [MAIN] Reserved : 16384 bytes / 4 sectors (1020 to 1023)
[000539]
[000540] [MAIN] EEPROM sectors: 1019, 1018, 1017, 1016
[000545] [MAIN] EEPROM current: 1017
[000548]
[000549] [MAIN] EEPROM: 4096 bytes initially | 272 bytes used ( 6%) | 3824 bytes free (93%)
[000558] [MAIN] Heap : 32840 bytes initially | 5408 bytes used (16%) | 27432 bytes free (83%)
[000566] [MAIN] Stack : 4096 bytes initially | 816 bytes used (19%) | 3280 bytes free (80%)
[000574]
[000575] [MAIN] Boot version: 31
[000578] [MAIN] Boot mode: 1
[000580] [MAIN] Last reset reason: Reboot from terminal
[000585]
[000586] [MAIN] Board: NODEMCU_LOLIN_EG_POWER
[000590] [MAIN] Support: ALEXA API BROKER BUTTON DEBUG_SERIAL DEBUG_TELNET DEBUG_WEB DOMOTICZ HOMEASSISTANT I2C LED MDNS_SERVER MQTT NTP SCHEDULER SENSOR TELNET TERMINAL THINGSPEAK WEB
[000606] [MAIN] Sensors: BMX280 EMON_ADX1X15
[000610] [MAIN] WebUI image: SENSOR
[000613]
[000841] [MAIN] Firmware MD5: cefc7773ebc73bf1e45bee6ebccae691
[000842] [MAIN] Power: 2788 mV
[000842] [MAIN] WiFi Sleep Mode: MODEM
[000843]

---8<-------

[000852] [TELNET] Listening on port 23
[000853] [WEBSERVER] Webserver running on port 80
[000855] [RELAY] Retrieving mask: 0
[000855] [RELAY] Relay #0 boot mode 0
[000858] [RELAY] #0 set to OFF
[000862] [RELAY] Number of relays: 1
[000864] [BUTTON] Number of buttons: 1
[000868] [LED] Number of leds: 1
[000871] [MQTT] Async ENABLED, SSL DISABLED, Autoconnect ENABLED
[000876] [MQTT] Client DISABLED, DISCONNECTED
[000880] [MQTT] Retry WAITING (Now 880, Last 0, Delay 5000, Step 5000)
[000891] [NTP] Update intervals: 81s / 2745s
[000892] [I2C] Using GPIO4 for SDA and GPIO5 for SCL
[000904] [I2C] Device found at address 0x48
[000909] [I2C] Device found at address 0x76
[FAUXMO] Device 'EGPOWER1' added as #0
[000912] [THINGSPEAK] Async ENABLED, SSL DISABLED
[000914] [SENSOR] Initializing BMP280 @ I2C (0x00)
[000924] [I2C] Address 0x76 locked
[000939] [SENSOR] -> temperature:0
[000939] [SENSOR] -> pressure:0
[000939] [SENSOR] -> humidity:0
[000940] [SENSOR] Initializing EMON @ ADS1115 @ I2C (0x00)
[000942] [I2C] Address 0x48 locked
[002123] [RELAY] Setting relay mask: 0
[002908] [SENSOR] -> current:0
[002909] [SENSOR] -> current:1
[002909] [SENSOR] -> current:2
[002909] [SENSOR] -> current:3
[002909] [SENSOR] -> apparent:0
[002911] [SENSOR] -> apparent:1
[002914] [SENSOR] -> apparent:2
[002917] [SENSOR] -> apparent:3
[002920] [SENSOR] -> energy:0
[002923] [SENSOR] -> energy:1
[002925] [SENSOR] -> energy:2
[002928] [SENSOR] -> energy:3
[003076] [WIFI] Scanning
[005209] [WIFI] BSSID: 0E:41:58:00:C5:7A CH: 1 RSSI: -90 SEC: WPA2 SSID: UPC7590224
[005209] [WIFI] --> BSSID: F8:1A:67:A5:CB:FC CH: 7 RSSI: -42 SEC: WPA2 SSID: TEKENER
[005213] [WIFI] BSSID: 14:CC:20:0C:91:95 CH: 4 RSSI: -82 SEC: WPA2 SSID: GUCKI
[005220] [WIFI] BSSID: 44:AA:F5:DA:41:5B CH: 9 RSSI: -78 SEC: WPA2 SSID: EGHORIZON
[005228] [WIFI] BSSID: 34:2C:C4:93:7B:B7 CH: 11 RSSI: -61 SEC: AUTO SSID: WLAN12415220
[005236] [WIFI] BSSID: 36:2C:94:93:7B:B7 CH: 11 RSSI: -61 SEC: OPEN SSID: UPC Wi-Free
[005244] [WIFI] BSSID: 64:7C:34:AF:C7:FF CH: 11 RSSI: -79 SEC: AUTO SSID: UPC3045006
[005251] [WIFI] BSSID: 06:7C:34:AF:C7:FF CH: 11 RSSI: -80 SEC: OPEN SSID: UPC Wi-Free
[005271] [WIFI] Connecting to BSSID: F8:1A:67:A5:CB:FC CH: 07, RSSI: -42, SEC: WPA2, SSID: TEKENER
[005418] [WIFI] Captive portal disabled
[005418] [WIFI] ------------------------------------- MODE STA
[005418] [WIFI] SSID TEKENER
[005419] [WIFI] IP 192.168.2.41
[005422] [WIFI] MAC CC:50:E3:5B:8C:CF
[005425] [WIFI] GW 192.168.2.1
[005428] [WIFI] DNS 192.168.2.4
[005431] [WIFI] MASK 255.255.255.0
[005434] [WIFI] HOST http://EGPOWER1.local
[005438] [WIFI] BSSID F8:1A:67:A5:CB:FC
[005441] [WIFI] CH 7
[005443] [WIFI] RSSI -44
[005446] [WIFI] ----------------------------------------------
[005453] [MDNS] OK
[006454] [MQTT] MQTT brokers found: 0
[FAUXMO] Enabled
[FAUXMO] UDP server started
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[020448] [NTP] UTC Time : 2019-07-21 13:57:21
[020449] [NTP] Local Time: 2019-07-21 15:57:21
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[060004] [MAIN] System OK
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[198094] [WEBSERVER] Request: GET /index.html
[198477] [WEBSERVER] Request: GET /auth
[198927] [WEBSOCKET] #1 connected, ip: 192.168.2.105, url: /ws

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

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

stack>>>
3ffffd20: 3fff3d5c 3fffa6b0 3fff0ee4 4020dac5
3ffffd30: 00001014 00001014 00001014 00000000
3ffffd40: 00000001 3fff87a4 3fff0ee4 40216f19
3ffffd50: 00000000 00000000 00000000 3fff6654
3ffffd60: 00000001 3fff6654 3fff8538 40216fa7
3ffffd70: 3ffe9838 00000000 3fffa324 00002000
3ffffd80: 3fff7794 00000001 000000c0 000000a8
3ffffd90: 00000002 00000069 3ffffdd0 00000000
3ffffda0: 3fff87a4 00000000 3fff0ee4 40218e13
3ffffdb0: 3fff3f24 0000071b 0000071b 4010020c
3ffffdc0: 00000001 3fff87a4 3ffffe10 4010068c
3ffffdd0: 3ffeadd8 6902a8c0 3ffffe10 4022e7b8
3ffffde0: 3fff2a8c 00000649 00000649 4010020c
3ffffdf0: 00000001 00000000 3ffffe40 3fff82ac
3ffffe00: 00000001 3fff87a4 00000000 4022f0c2
3ffffe10: 3fff6b54 3ffe91d4 4022306c 4022fb91
3ffffe20: 00000000 40222fc4 3fff87a4 4022182d
3ffffe30: 3fff2a8c 00000000 3fff87a4 40222116
3ffffe40: 3fff87a4 3ffeb328 40221580 40222bc0
3ffffe50: 3fff81cc 0000019f 3fff6adc 401004d8
3ffffe60: 3fff2a8c 00000a28 00000a28 3fff3078
3ffffe70: 00000101 0000019f 3fff6adc 4022214d
3ffffe80: 3fff82ac 3fff2f5c 00000040 401074e4
3ffffe90: 3fff83bc 3fff3084 3fff82ac 4022fbf0
3ffffea0: 3fff82ac 00000101 3fff81cc 402231c9
3ffffeb0: 00000001 3fff3270 3fff81cc 4021c044
3ffffec0: 3fff6b84 3fff3080 3fff307c 4021c064
3ffffed0: 3fff6b84 3fff3080 3fff307c 40245149
3ffffee0: 00000000 2902a8c0 00000010 00000000
3ffffef0: 00000010 00000000 3fff324c 00000040
3fffff00: 40100000 00000000 00000064 3fff3268
3fffff10: 3ffebf46 3fff3270 3fff8dec 40243699
3fffff20: 3fff2f74 3fff7794 3fff7794 40241b45
3fffff30: 00000000 03b45092 40231817 3fff7794
3fffff40: 3ffebf38 00000000 3fff8dec 40242a91
3fffff50: 6902a8c0 00000000 00000001 4022ea91
3fffff60: 40104832 03b45dc6 3ffefa40 40201dbc
3fffff70: 40237208 3ffefa28 3ffefa40 0bdb6079
3fffff80: 4023722e 3fffdab0 00000000 3fff7804
3fffff90: 3fffdc80 00000000 3fff8dec 4023a70b
3fffffa0: 40000f49 3fffdab0 3fffdab0 40000f49
<<<stack<<<

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

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09826c6d
~ld
[000373]

---8<-------

[000373] [MAIN] ESPURNA 1.13.6-dev
[000373] [MAIN] xose.perez@gmail.com
[000373] [MAIN] http://tinkerman.cat

[000373] [MAIN] CPU chip ID: 0x5B8CCF
[000377] [MAIN] CPU frequency: 80 MHz
[000380] [MAIN] SDK version: 1.5.3(aec24ac9)
[000384] [MAIN] Core version: 2.3.0
[000387] [MAIN] Core revision: 9826c6d
[000390] [MAIN] Build time: 1563724357
[000394]
[000395] [MAIN] Flash chip ID: 0x1640EF
[000398] [MAIN] Flash speed: 40000000 Hz
[000402] [MAIN] Flash mode: DOUT
[000405]
[000406] [MAIN] Flash size (CHIP) : 4194304 bytes / 1024 sectors ( 0 to 1023)
[000413] [MAIN] Flash size (SDK) : 4194304 bytes / 1024 sectors ( 0 to 1023)
[000420] [MAIN] Reserved : 4096 bytes / 1 sectors ( 0 to 0)
[000427] [MAIN] Firmware size : 502016 bytes / 123 sectors ( 1 to 123)
[000434] [MAIN] Max OTA size : 2637824 bytes / 644 sectors ( 124 to 767)
[000442] [MAIN] SPIFFS size : 1015808 bytes / 248 sectors ( 768 to 1015)
[000449] [MAIN] EEPROM size : 16384 bytes / 4 sectors (1016 to 1019)
[000456] [MAIN] Reserved : 16384 bytes / 4 sectors (1020 to 1023)
[000463]
[000464] [MAIN] EEPROM sectors: 1019, 1018, 1017, 1016
[000469] [MAIN] EEPROM current: 1019
[000472]
[000473] [MAIN] EEPROM: 4096 bytes initially | 305 bytes used ( 7%) | 3791 bytes free (92%)
[000481] [MAIN] Heap : 32840 bytes initially | 5408 bytes used (16%) | 27432 bytes free (83%)
[000490] [MAIN] Stack : 4096 bytes initially | 864 bytes used (21%) | 3232 bytes free (78%)
[000498]
[000499] [MAIN] Boot version: 31
[000501] [MAIN] Boot mode: 1
[000504] [MAIN] Last reset reason: Exception
[000508] [MAIN] Last reset info: Fatal exception:29 flag:2 (EXCEPTION) epc1:0x4020eec2 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000
[000521]
[000522] [MAIN] Board: NODEMCU_LOLIN_EG_POWER
[000526] [MAIN] Support: ALEXA API BROKER BUTTON DEBUG_SERIAL DEBUG_TELNET DEBUG_WEB DOMOTICZ HOMEASSISTANT I2C LED MDNS_SERVER MQTT NTP SCHEDULER SENSOR TELNET TERMINAL THINGSPEAK WEB
[000542] [MAIN] Sensors: BMX280 EMON_ADX1X15
[000546] [MAIN] WebUI image: SENSOR
[000549]
[000778] [MAIN] Firmware MD5: cefc7773ebc73bf1e45bee6ebccae691
[000779] [MAIN] Power: 2789 mV
[000779] [MAIN] WiFi Sleep Mode: MODEM
[000779]

---8<-------

[000788] [TELNET] Listening on port 23
[000790] [WEBSERVER] Webserver running on port 80
[000791] [RELAY] Retrieving mask: 0
[000791] [RELAY] Relay #0 boot mode 0
[000795] [RELAY] #0 set to OFF
[000798] [RELAY] Number of relays: 1
[000801] [BUTTON] Number of buttons: 1
[000804] [LED] Number of leds: 1
[000807] [MQTT] Async ENABLED, SSL DISABLED, Autoconnect ENABLED
[000812] [MQTT] Client DISABLED, DISCONNECTED
[000816] [MQTT] Retry WAITING (Now 816, Last 0, Delay 5000, Step 5000)
[000827] [NTP] Update intervals: 81s / 2532s
[000828] [I2C] Using GPIO4 for SDA and GPIO5 for SCL
[000840] [I2C] Device found at address 0x48
[000846] [I2C] Device found at address 0x76
[FAUXMO] Device 'EGPOWER1' added as #0
[000848] [THINGSPEAK] Async ENABLED, SSL DISABLED
[000850] [SENSOR] Initializing BMP280 @ I2C (0x00)
[000862] [I2C] Address 0x76 locked
[000877] [SENSOR] -> temperature:0
[000877] [SENSOR] -> pressure:0
[000877] [SENSOR] -> humidity:0
[000877] [SENSOR] Initializing EMON @ ADS1115 @ I2C (0x00)
[000880] [I2C] Address 0x48 locked
[002062] [RELAY] Setting relay mask: 0
[002848] [SENSOR] -> current:0
[002848] [SENSOR] -> current:1
[002849] [SENSOR] -> current:2
[002849] [SENSOR] -> current:3
[002849] [SENSOR] -> apparent:0
[002851] [SENSOR] -> apparent:1
[002854] [SENSOR] -> apparent:2
[002857] [SENSOR] -> apparent:3
[002860] [SENSOR] -> energy:0
[002862] [SENSOR] -> energy:1
[002865] [SENSOR] -> energy:2
[002868] [SENSOR] -> energy:3
[003015] [WIFI] Scanning
[005150] [WIFI] BSSID: 0E:41:58:00:C5:7A CH: 1 RSSI: -90 SEC: WPA2 SSID: UPC7590224
[005150] [WIFI] BSSID: 14:CC:20:0C:91:95 CH: 4 RSSI: -78 SEC: WPA2 SSID: GUCKI
[005154] [WIFI] --> BSSID: F8:1A:67:A5:CB:FC CH: 7 RSSI: -40 SEC: WPA2 SSID: TEKENER
[005161] [WIFI] BSSID: 44:AA:F5:DA:41:5B CH: 9 RSSI: -79 SEC: WPA2 SSID: EGHORIZON
[005169] [WIFI] BSSID: 34:2C:C4:93:7B:B7 CH: 11 RSSI: -63 SEC: AUTO SSID: WLAN12415220
[005177] [WIFI] BSSID: 36:2C:94:93:7B:B7 CH: 11 RSSI: -66 SEC: OPEN SSID: UPC Wi-Free
[005184] [WIFI] BSSID: 64:7C:34:AF:C7:FF CH: 11 RSSI: -76 SEC: AUTO SSID: UPC3045006
[005192] [WIFI] BSSID: 06:7C:34:AF:C7:FF CH: 11 RSSI: -74 SEC: OPEN SSID: UPC Wi-Free
[005212] [WIFI] Connecting to BSSID: F8:1A:67:A5:CB:FC CH: 07, RSSI: -40, SEC: WPA2, SSID: TEKENER
[005379] [WIFI] Captive portal disabled
[005379] [WIFI] ------------------------------------- MODE STA
[005380] [WIFI] SSID TEKENER
[005380] [WIFI] IP 192.168.2.41
[005383] [WIFI] MAC CC:50:E3:5B:8C:CF
[005386] [WIFI] GW 192.168.2.1
[005389] [WIFI] DNS 192.168.2.4
[005392] [WIFI] MASK 255.255.255.0
[005395] [WIFI] HOST http://EGPOWER1.local
[005399] [WIFI] BSSID F8:1A:67:A5:CB:FC
[005403] [WIFI] CH 7
[005405] [WIFI] RSSI -44
[005407] [WIFI] ----------------------------------------------
[005413] [MDNS] OK
[006415] [MQTT] MQTT brokers found: 0
[FAUXMO] Enabled
[FAUXMO] UDP server started
[011005] [NTP] UTC Time : 2019-07-21 14:00:31
[011006] [NTP] Local Time: 2019-07-21 16:00:31
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request
[FAUXMO] Responding to M-SEARCH request


keys:

[180224] Current settings:
[180224] > adminPass => "xxxxxxxxx"
[180224] > boardName => "NODEMCU_LOLIN_EG_POWER"
[180224] > cfg => "3"
[180225] > dns0 => "192.168.2.4"
[180227] > dns1 => "192.168.2.4"
[180230] > gw0 => "192.168.2.1"
[180233] > gw1 => "192.168.2.1"
[180236] > hostname => "EGPOWER1"
[180239] > ip0 => "192.168.2.41"
[180242] > ip1 => "192.168.2.41"
[180244] > ledMode0 => "1"
[180247] > ledRelay0 => "0"
[180249] > mask0 => "255.255.255.0"
[180252] > mask1 => "255.255.255.0"
[180255] > mqttEnabled => "1"
[180258] > mqttServer => "192.168.2.19"
[180261] > ntpServer0 => "192.168.2.4"
[180265] > pass0 => "xxxxxxxxxxxxxxxxxxxxxx"
[180269] > pass1 => "xxxxxxxxxxxxxxxxxxxxxx"
[180273] > snsReport => "10"
[180275] > snsResetTS => "2019-07-21 15:57:01"
[180279] > ssid0 => "TEKENER"
[180282] > ssid1 => "GUCKI"
[180284] > sysScTraceMax => "128"
[180287] > tmpCorrection => "-0.5"
[180290] Number of keys: 25
[180293] Current EEPROM sector: 1016
[180296] Free EEPROM: 3565 bytes (87%)
[180299] +OK


info:

[225802] [MAIN] ESPURNA 1.13.6-dev
[225802] [MAIN] xose.perez@gmail.com
[225802] [MAIN] http://tinkerman.cat

[225803] [MAIN] CPU chip ID: 0x5B8CCF
[225807] [MAIN] CPU frequency: 80 MHz
[225809] [MAIN] SDK version: 1.5.3(aec24ac9)
[225813] [MAIN] Core version: 2.3.0
[225816] [MAIN] Core revision: 9826c6d
[225820] [MAIN] Build time: 1563724357
[225823]
[225824] [MAIN] Flash chip ID: 0x1640EF
[225828] [MAIN] Flash speed: 40000000 Hz
[225831] [MAIN] Flash mode: DOUT
[225834]
[225835] [MAIN] Flash size (CHIP) : 4194304 bytes / 1024 sectors ( 0 to 1023)
[225842] [MAIN] Flash size (SDK) : 4194304 bytes / 1024 sectors ( 0 to 1023)
[225849] [MAIN] Reserved : 4096 bytes / 1 sectors ( 0 to 0)
[225856] [MAIN] Firmware size : 502016 bytes / 123 sectors ( 1 to 123)
[225864] [MAIN] Max OTA size : 2637824 bytes / 644 sectors ( 124 to 767)
[225871] [MAIN] SPIFFS size : 1015808 bytes / 248 sectors ( 768 to 1015)
[225878] [MAIN] EEPROM size : 16384 bytes / 4 sectors (1016 to 1019)
[225885] [MAIN] Reserved : 16384 bytes / 4 sectors (1020 to 1023)
[225892]
[225894] [MAIN] EEPROM sectors: 1019, 1018, 1017, 1016
[225898] [MAIN] EEPROM current: 1016
[225901]
[225902] [MAIN] EEPROM: 4096 bytes initially | 531 bytes used (12%) | 3565 bytes free (87%)
[225912] [MAIN] Heap : 32840 bytes initially | 16728 bytes used (50%) | 16112 bytes free (49%)
[225919] [MAIN] Stack : 4096 bytes initially | 1456 bytes used (35%) | 2640 bytes free (64%)
[225927]
[225928] [MAIN] Boot version: 31
[225931] [MAIN] Boot mode: 1
[225933] [MAIN] Last reset reason: Exception
[225937] [MAIN] Last reset info: Fatal exception:29 flag:2 (EXCEPTION) epc1:0x4020eec2 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000
[225951]
[225952] [MAIN] Board: NODEMCU_LOLIN_EG_POWER
[225956] [MAIN] Support: ALEXA API BROKER BUTTON DEBUG_SERIAL DEBUG_TELNET DEBUG_WEB DOMOTICZ HOMEASSISTANT I2C LED MDNS_SERVER MQTT NTP SCHEDULER SENSOR TELNET TERMINAL THINGSPEAK WEB
[225972] [MAIN] Sensors: BMX280 EMON_ADX1X15
[225976] [MAIN] WebUI image: SENSOR
[225979]
[225980] [MAIN] Firmware MD5: cefc7773ebc73bf1e45bee6ebccae691
[225986] [MAIN] Power: 2788 mV
[225988] [MAIN] Power saving delay value: 10 ms


@gernst48
Copy link
Author

Sorry I was to fast.
I want to give more information:
The board and software is still working (I get all requested MQTT information).
Only connecting the webinterface does the crash.

@gernst48
Copy link
Author

I like to debug my firmware on my own, because I detected some different behaviour when
i play around with the EMON_ADS1X15_SUPPORT configuration flags EMON_???.
Is there any debugger I could use with the Visual Studio Code ?
Or at least a ELF file viewer ?
Or how do you debug your firmware ?

@tonilopezmr
Copy link
Contributor

Like this proposal: #1823 (comment) you can decode your stack trace.
For debug, add logs and see the logs using USB, and then try to understand printing your own messages etc...

@gernst48
Copy link
Author

gernst48 commented Aug 3, 2019

Depending on the parameter I use for the EMON_ADX1X15 there are differne behaviour.
With the default parameter the firmware starts as expected.
when I reload the web page the exception 29 happens.
Loading the web page again every thing is working again, and so on ...
Analyzing the trace and looking around with google gives me the feeling
there is somthing wrong with the heap and the stack.
I believe the heap grows up to the stack and then the exception 29 happens.
So, do you have any idea how I could check the heap fragmention ?
Or to implement an exception handler to catch and test this case ?

@gernst48
Copy link
Author

gernst48 commented Aug 3, 2019

When I use my own parameters for the EMON_ADX1X15 which displays more web data in the
web status page, I got for every web page load the exception 29.
I could not display any web page anymore.
Only the serial debug interface is still working.
Again, in my opinion there seems to be a big heap problem.

@mcspr
Copy link
Collaborator

mcspr commented Aug 4, 2019

There are a couple of issues, but I still don't quite understand why this is happening specifically because of reload (ref: #1824)

  • 28/29 most of the time is allocation failure + trying to access something that is expected to be in the allocated area. auto obj = new Object();, obj->method() -> exception, because obj is nullptr. One point is ws WebSocketIncommingBuffer creation / deletion. Another, is 3K+ JsonObject string serialization + ~1K JsonDynamicBuffer as a storage that is reallocing in size periodically
    And technically, using never Cores it will cause c++ bad_alloc instead, crashing anyways.
  • for heap specifically there is espurna/libs/HeapStats.h ::getHeapStats, there are usable and frag_pct struct members. Note that you will need to build with Arduino Core 2.5.2 for it to work at all. There are more heap though, so one would need to do 2 things - add disable_extra4k_at_link_time(); somewhere in setup and malloc(N-bytes) to have the same heap as the old 2.3.0 does.

At first I thought this was something wrong with ADX sensor specifically, but my guess it is a more generic issue.

@gernst48
Copy link
Author

gernst48 commented Aug 4, 2019

The reload error is quit clear for me.
Because it seems either the send buffer is not returned or the heap gets fragmemted and
ther is not enough memory for the next send buffer allocation.
After the exceptio 29 and the reboot everything is clean and working again.
Until the next buffer allocation ....
Maybe we should try to implement a static send buffer for test and watching what happens.

@mcspr
Copy link
Collaborator

mcspr commented Aug 4, 2019

Right. And the main point is that sensor firmware + energy sensor, json buffer is like 6K (all those keys) + json string 3K. Fixed-size buffer is no problem as some brief tests show, but it needs a middle ground solution between sending each callback (which can be either 1 key-value or giant monster like sensor one) separately and sending all at once (which is what it is right now and kind of broken).
And likely moving really static things before everything else, since we would know the size beforehand.

And I'll correct myself about the realloc part - the algorithm used by Dynamic json buffer is to start with 256 bytes and add a double-size block each time something does not fit. Manually specifying the size still does this though, unless the buffer is Static / is in the stack.

@gernst48
Copy link
Author

gernst48 commented Aug 8, 2019

Sorry, does not work for me.

Maybe there is something wrong in the configuration.
I use the following in platformio.ini for my board, but you have change a lot in this file.
The base for me is the following:
[env:nodemcu-lolin]
board = ${common.board_4m}
build_flags = ${common.build_flags_4m1m} -DNODEMCU_LOLIN -DDEBUG_FAUXMO=Serial -DNOWSAUTH
My board uses the following configuration:
[env:nodemcu-lolin-eg-power]
board = ${common.board_4m}
build_flags = ${common.build_flags_4m1m} -DNODEMCU_LOLIN_EG_POWER -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DSENSOR_SUPPORT=1

But I missing a lot from the old platformio.ini file e.g.:
[env:nodemcu-lolin-eg-power]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_4m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_4m1m} -DNODEMCU_LOLIN_EG_POWER -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DSENSOR_SUPPORT=1
upload_speed = ${common.upload_speed_fast}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}

I believe my configuration is wrong.
Please let me know what I have to configure for my board.
And by the way, is the Firmware version still 1.13.6-dev ?

Here is the status output of my board:
Manufacturer NODEMCU
Device LOLIN_EG_POWER
Chip ID 5B8CCF
Wifi MAC CC:50:E3:5B:8C:CF
SDK version 1.5.3(aec24ac9)
Core version 2.3.0
Firmware name ESPURNA
Firmware version 1.13.6-dev
Firmware revision
Firmware build date 2019-08-08 23:23:09
Firmware size 502576 bytes
Free space 2641920 bytes
Network TEKENER BSSID F8:1A:67:A5:CB:FC Channel 7 RSSI -56 IP 192.168.2.41 (telnet)
Free heap 11736 bytes
Load average 1%
VCC 2788mV
MQTT Status CONNECTED
NTP Status SYNC'D Current time 2019-08-08 23:54:33
Uptime 0d 00h 14m 56s
Last update 23 seconds ago

Hope you could enlight my dark brain.

@mcspr
Copy link
Collaborator

mcspr commented Aug 9, 2019

[env:nodemcu-lolin-eg-power] config is fine, latest update to .ini file removed a lot of duplicated strings per env. Instead, they are inherited from the [env] block at the top
Version only changes between releases btw. Revision string is supposed to point to the specific commit but is not set for local builds right now.

#1843 does not work?
Have you tried decoding the stack trace that happens? >>>stack>>> ... <<<stack<<< lines contain raw addresses specific to the binary you have and we can only guess where the crash happens exactly. If you are having problems with that, just post the trace text and the .elf file (located at .pio/build/nodemcu-lolin-eg-power/firmware.elf)

I am running the config you provided in the first post, with BMX280 & ADS1X15 giving out dummy values and WebUI loads fine with Firefox on Windows machine.
Maybe some local environment is the cause? Can you try disabling Alexa (as I see some network activity there)? ALEXA_ENABLED & ALEXA_SUPPORT set to 0, or alexaEnabled at runtime?

I do see that 13824 bytes of free heap though, you got slightly lower value.
edit: Nevermind. Loading initially it is 11168, which is around the same value as yours.

Have you tried connecting to the device directly, via SoftAP mode?

@gernst48
Copy link
Author

gernst48 commented Aug 9, 2019

Please find attached all by traces and opinions:
Power-Stack-Default-Decode-4.txt

@mcspr
Copy link
Collaborator

mcspr commented Aug 9, 2019

Thank you!

21 0x4020db21: ArduinoJson::Internals::JsonPrintable<ArduinoJson::JsonObject>::measureLength() const at W:/GitRepos/espurna-dev/code/espurna/ws.ino:528
22 0x40216fed: wsSend(unsigned int, ArduinoJson::JsonObject&) at W:/GitRepos/espurna-dev/code/espurna/ws.ino:528
23 0x4021707b: _wsStart(unsigned int) at W:/GitRepos/espurna-dev/code/espurna/ws.ino:528

measureLength() part is consistent with the other issue - problem happens when json serializer tries to do something on supposedly broken json buffer structure. However, this crash is expected as this is still with the current dev version and not the linked PR (easily seen, as there is no longer any _wsStart() function in the new code)

The proposed fix is in the web/fixed-size-json-v5 branch, which you can test via

  • git clone -b web/fixed-size-json-v5 https://github.com/mcspr/espurna.git espurna-test
    and build that
  • add https://github.com/mcspr/espurna as a git remote in the existing repo and checkout the PR branch
  • git fetch origin pull/1843/head:pr-1843 & git checkout pr-1843
    (ref: https://help.github.com/en/articles/checking-out-pull-requests-locally)

@gernst48
Copy link
Author

gernst48 commented Aug 9, 2019

Sorry my error.
As always, if you used the right one everything is working as expected.
I could confirm the test branch is working for all my configurations.

@mcspr mcspr closed this as completed Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants