WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ajkbcd
New user
Posts: 8
Joined: 14 Oct 2019, 08:05
Location: Bacolod City, Philippines

WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#1 Post by ajkbcd » 14 Oct 2019, 08:23

ESP-12F
ESP_Easy_mega-20190817_normal_ESP8266_4M.bin


I'd appreciate any help possible to solve this, I've googled and searched these boards for similar but am unable to solve it, is it a known bug? Thanks.

After wi-fi router power off/on, ESP resets with the following: (captured from the serial output)

...
10/12 23:23:25>7009866 : EVENT: WiFi#Disconnected
10/12 23:23:25>7010102 : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2870 ms
10/12 23:23:25>7010809 : WIFI : Connecting SmartHome attempt #2
10/12 23:23:26>7010811 : IP : Static IP : 192.168.2.3 GW: 192.168.2.1 SN: 255.255.255.0 DNS: 8.8.8.8
10/12 23:23:26>7010817 : WIFI : WiFi.status() = WL_DISCONNECTED SSID: SmartHome
10/12 23:23:26>10/12 23:23:27>7011985 : ADC : Analog value: 1024 = 12.012 (24 samples)
10/12 23:23:27>7011992 : EVENT: battery#volts=12.01
10/12 23:23:27>10/12 23:23:28>scandone
10/12 23:23:29>7013833 : EVENT: WiFi#Disconnected
10/12 23:23:29>7014068 : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2874 ms
10/12 23:23:29>7014544 : WIFI : Connecting SmartHome attempt #3
10/12 23:23:30>7014547 : IP : Static IP : 192.168.2.3 GW: 192.168.2.1 SN: 255.255.255.0 DNS: 8.8.8.8
10/12 23:23:30>7014552 : WIFI : WiFi.status() = WL_DISCONNECTED SSID: SmartHome
10/12 23:23:30>10/12 23:23:31>10/12 23:23:32>scandone
10/12 23:23:33>7017546 : EVENT: WiFi#Disconnected
10/12 23:23:33>7017782 : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2857 ms
10/12 23:23:33>7018029 : WIFI : Connecting SmartHome attempt #4
10/12 23:23:33>7018032 : IP : Static IP : 192.168.2.3 GW: 192.168.2.1 SN: 255.255.255.0 DNS: 8.8.8.8
10/12 23:23:33>7018037 : WIFI : WiFi.status() = WL_DISCONNECTED SSID: SmartHome
10/12 23:23:33>10/12 23:23:34>10/12 23:23:35>scandone
10/12 23:23:36>7021042 : EVENT: WiFi#Disconnected
10/12 23:23:36>7021276 : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2857 ms
10/12 23:23:36>7021552 : DS: SP: 48,2,4b,46,1f,ff,1f,10,f8,OK,7
10/12 23:23:37>7021562 : DS : Temperature: 36.50 (28-ff-39-bd-6d-18-1-42)
10/12 23:23:37>7021567 : EVENT: ds18b20#temp=36.50
10/12 23:23:37>7022264 : WIFI : Connecting SmartHome attempt #5
10/12 23:23:37>7022267 : IP : Static IP : 192.168.2.3 GW: 192.168.2.1 SN: 255.255.255.0 DNS: 8.8.8.8
10/12 23:23:37>7022272 : WIFI : WiFi.status() = WL_DISCONNECTED SSID: SmartHome
10/12 23:23:37>7022633 : ADC : Analog value: 1024 = 12.012 (18 samples)
10/12 23:23:38>7022640 : EVENT: battery#volts=12.01
10/12 23:23:38>scandone
10/12 23:23:38>del if0
10/12 23:23:38>usl
10/12 23:23:38>mode : null
10/12 23:23:38>7023217 : WIFI : Set WiFi to AP+STA
10/12 23:23:38>7023319 : WIFI : Set WiFi to AP
10/12 23:23:39>7023420 : WIFI : Set WiFi to AP
10/12 23:23:39>7023521 : WIFI : Set WiFi to AP
10/12 23:23:39>7023622 : WIFI : Set WiFi to AP
10/12 23:23:39>7023724 : WIFI : Set WiFi to AP
10/12 23:23:39>7023825 : WIFI : Set WiFi to AP
10/12 23:23:39>7023926 : WIFI : Set WiFi to APFatal exception 9(LoadStoreAlignmentCause):
10/12 23:23:39>epc1=0x402779c9, epc2=0x00000000, epc3=0x400046b4, excvaddr=0x00000002, depc=0x00000000

10/12 23:23:39>
10/12 23:23:39>Exception (9):
10/12 23:23:39>epc1=0x402779c9 epc2=0x00000000 epc3=0x400046b4 excvaddr=0x00000002 depc=0x00000000
10/12 23:23:39>
10/12 23:23:39>>>>stack>>>
10/12 23:23:39>
10/12 23:23:39>ctx: sys
10/12 23:23:39>sp: 3fff0e20 end: 3fffffb0 offset: 01a0
10/12 23:23:39>3fff0fc0: 3fff0fe0 00000000 3ffef960 4022897d
...

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#2 Post by TD-er » 14 Oct 2019, 09:03

What version is this?
Did you build it yourself?
What exact build did you use? (file name, core version, LWIP version)

The error indicates that data is being read from flash which is not aligned to a 32-bit address. (address is not dividable by 4)

ajkbcd
New user
Posts: 8
Joined: 14 Oct 2019, 08:05
Location: Bacolod City, Philippines

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#3 Post by ajkbcd » 14 Oct 2019, 11:22

ESP-12F
ESP_Easy_mega-20190817_normal_ESP8266_4M.bin
The build binary was downloaded from the github site.
I searched for this problem specifically using the error message, but I since have seen there are other WDT resets when WIFI is trying to reconnect to the AP. Maybe it is related?
Not sure what other info to give you, anything else please advise. I'll update my firmware to a newer build level, and report results back here.
The fault described here is repeatable, every time I power on the AP after a AP power off.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#4 Post by TD-er » 14 Oct 2019, 12:07

Could you please try a newer version, since I did fix a lot with regards to WiFi in the last few months.
If you experience issues related to rules in the last build, use the last one of September and please report any rules related issues.

ajkbcd
New user
Posts: 8
Joined: 14 Oct 2019, 08:05
Location: Bacolod City, Philippines

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#5 Post by ajkbcd » 14 Oct 2019, 15:12

Upgraded build to: ESP_Easy_mega-20191003_normal_ESP8266_4M1M.bin

No more "Fatal exception" error, but the WDT reset still occurs.

[NOTE: the timestamp is from my serial port capture program (10/14 20:45:50>) ]

Help appreciated.


Output from serial:

...
10/14 20:45:50>6169382 : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2858 ms
10/14 20:45:50>6169384 : WIFI : Switch off WiFi10/14 20:45:51>
10/14 20:45:51>6170602 : WIFI : Set WiFi to AP
10/14 20:45:51>6170703 : WIFI : Set WiFi to AP
10/14 20:45:52>6170804 : WIFI : Set WiFi to AP
10/14 20:45:52>6170905 : WIFI : Set WiFi to AP
10/14 20:45:52>6171006 : WIFI : Set WiFi to AP
10/14 20:45:52>6171108 : WIFI : Set WiFi to AP
10/14 20:45:52>6171209 : WIFI : Set WiFi to AP
10/14 20:45:52>6171310 : WIFI : Set WiFi to AP10/14 20:45:53>10/14 20:45:54>10/14 20:45:55>10/14 20:45:56>10/14 20:45:57>10/14 20:45:58>10/14 20:45:59>10/14 20:46:00>
10/14 20:46:00> ets Jan 8 2013,rst cause:4, boot mode:(3,7)
10/14 20:46:00>
10/14 20:46:00>wdt reset
10/14 20:46:00>load 0x4010f000, len 1384, room 16
10/14 20:46:00>tail 8
10/14 20:46:00>chksum 0x2d
10/14 20:46:00>csum 0x2d
10/14 20:46:00>v8b899c12
10/14 20:46:00>~ld
10/14 20:46:00>¦U63 :
10/14 20:46:00>
INIT : Booting version: mega-20191003 (ESP82xx Core 2_5_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.1.2 PUYA support)

ajkbcd
New user
Posts: 8
Joined: 14 Oct 2019, 08:05
Location: Bacolod City, Philippines

Re: WIFI RECONNECT

#6 Post by ajkbcd » 18 Oct 2019, 11:18

Regarding the WIFI reconnect, I have tested 11 firmware builds from 20181125 (2_4_2/2.2.1/2.0.3) to 20191003 (2_5_2/2.2.1/2.0.3).
I captured the serial output from the ESP-12F for each build, w.r.t. WIFI RECONNECT after router power off/on.

It can be seen the last successful WIFI RECONNECT was the 20190630 build (2_4_2/2.2.1/2.0.3).
Since this build, the wifi reconnect fails in all tested builds, basically since Core 2_5_2.

I have recorded my results in an xls which I will upload if anyone wants the detailed serial output.

I hope this throws some light on the problem, but I don't have any solution. I really hope this wifi reconnect
can be fixed as I need to be able to reconnect the ESP after a power outage (with the ESP running on battery).

ajkbcd
New user
Posts: 8
Joined: 14 Oct 2019, 08:05
Location: Bacolod City, Philippines

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#7 Post by ajkbcd » 18 Oct 2019, 11:33

correction:
...tested 11 firmware builds from 20181125 (2_4_2/2.2.1/2.0.3) to 20191003 (2_5_2/2.2.1/2.0.3).
should be:
tested 11 firmware builds from 20181125 (2_4_2/2.2.1/2.0.3) to 20191003 (2_5_2/2.2.1/2.1.2).

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#8 Post by TD-er » 18 Oct 2019, 13:05

Please also test (one of the latest) builds with core 2.6.0

ajkbcd
New user
Posts: 8
Joined: 14 Oct 2019, 08:05
Location: Bacolod City, Philippines

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#9 Post by ajkbcd » 18 Oct 2019, 14:01

WDT reset event occurs while the wifi reconnection in progress:

mega-20191003 (ESP82xx Core 2.6.0-dev stage, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support)


10/18 19:28:57>10/18 19:28:58>617128 : WD : Uptime 10 ConnectFailures 0 FreeMem 20296 WiFiStatus 3
10/18 19:29:23>642157 : EVENT: WiFi#Disconnected
10/18 19:29:24>642341 : WIFI : Disconnected! Reason: '(200) Beacon timeout' Connected for 10 m 22 s
10/18 19:29:24>642343 : WIFI : Switch off WiFi
10/18 19:29:25>643677 : WIFI : Set WiFi to STA
10/18 19:29:26>643710 : WIFI : Connecting SmartHome attempt #0
10/18 19:29:26>644217 : MQTT : Connection lost, state: Connection lost
10/18 19:29:26>644218 : EVENT: MQTT#Disconnected
10/18 19:29:28>646812 : EVENT: WiFi#Disconnected
10/18 19:29:29>646995 : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2850 ms
10/18 19:29:29>646997 : WIFI : Switch off WiFi
10/18 19:29:30>648331 : WIFI : Set WiFi to STA
10/18 19:29:33>651530 : EVENT: WiFi#Disconnected
10/18 19:29:33>651713 : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2850 ms
10/18 19:29:34>651715 : WIFI : Switch off WiFi
10/18 19:29:35>653048 : WIFI : Set WiFi to STA
10/18 19:29:38>656183 : EVENT: WiFi#Disconnected
10/18 19:29:38>656365 : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2849 ms
10/18 19:29:38>656367 : WIFI : Switch off WiFi
10/18 19:29:39>657701 : WIFI : Set WiFi to STA
10/18 19:29:42>660877 : EVENT: WiFi#Disconnected
10/18 19:29:43>661060 : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2849 ms
10/18 19:29:43>661061 : WIFI : Switch off WiFi
10/18 19:29:44>662288 : WIFI : Set WiFi to AP
10/18 19:29:44>662389 : WIFI : Set WiFi to AP
10/18 19:29:44>662489 : WIFI : Set WiFi to AP
10/18 19:29:44>662589 : WIFI : Set WiFi to AP
10/18 19:29:45>662690 : WIFI : Set WiFi to AP
10/18 19:29:45>662790 : WIFI : Set WiFi to AP
10/18 19:29:45>662890 : WIFI : Set WiFi to AP
10/18 19:29:45>662991 : WIFI : Set WiFi to AP
10/18 19:29:52> ets Jan 8 2013,rst cause:4, boot mode:(3,7)
10/18 19:29:53>wdt reset
10/18 19:29:53>load 0x4010f000, len 1384, room 16
10/18 19:29:53>tail 8
10/18 19:29:53>chksum 0x2d
10/18 19:29:53>csum 0x2d
10/18 19:29:53>v89989329
10/18 19:29:53>~ld
10/18 19:29:53>¦U75 :
INIT : Booting version: mega-20191003 (ESP82xx Core 2.6.0-dev stage, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support)
10/18 19:29:53>76 : INIT : Free RAM:32336
10/18 19:29:53>77 : INIT : Warm boot #1 Last Task: Const Interval timer, id: 3 - Restart Reason: Hardware Watchdog

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#10 Post by TD-er » 18 Oct 2019, 16:04

Can you give some information about your setup?
I did fix some reconnect issues a few weeks ago regarding WiFi reconnect and thought it was now finally over with those.
Apparently it is now crashing when starting AP mode.

Do you switch off the AP you were connected to?
How do you trigger the ESP to start working in AP mode?

ajkbcd
New user
Posts: 8
Joined: 14 Oct 2019, 08:05
Location: Bacolod City, Philippines

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#11 Post by ajkbcd » 18 Oct 2019, 16:53

I have a custom battery powered pcb with ESP-12F.
I'm using GPIO 16 to switch a relay.
The router psu is diverted through the PCB, via the relay.
Under normal operation, the relay is off, and the router psu flows into the relay and out the
NC connection.
When switched, the relay will feed the NO connected battery supply to the router which then
powers on the router.
To control the switching of GPIO 16, I have a watchdog program running on a RPi Zero W,
when it detects a power outage using ping tests, it sends GPIO,16,1 over the serial i/f
to trigger and hold the relay.
Now I understand the difficulties using GPIO 16, High on boot, but under normal expected working
conditions, the ESP should not reboot.
Under normal working conditions, the WIFI is initially connected, then the power outage occurs,
the RPi WD switches the relay, the router powers back on, and the ESP reconnects
the WIFI connection.
Regardless, I will move the relay to GPIO 13, to avoid a possible state change on ESP restart.
The 20190630 build (Core 2_4_2) does the WIFI reconnect successfully.
So the AP is switched off due to the power outage, but I don't trigger the WIFI reconnection,
I use the ESP firmware to reconnect the WIFI connection, once the router powers back on.
Hope this is useful or interesting.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#12 Post by TD-er » 18 Oct 2019, 17:06

ajkbcd wrote: 18 Oct 2019, 16:53 [...]
Hope this is useful or interesting.
You must be watching the same Youtube channels I do ;)
I just hear him say it in my head :)

ajkbcd
New user
Posts: 8
Joined: 14 Oct 2019, 08:05
Location: Bacolod City, Philippines

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#13 Post by ajkbcd » 23 Dec 2019, 10:36

Just got around to re-testing this and happy to confirm your software is now working as expected.
No more WDT reset after wifi disconnect/reconnect attempt.

Thankyou very much!


Build version: 20191208 Normal

12/23 17:09:20>12/23 17:09:21>12/23 17:09:22>12/23 17:09:23>3894992 : Info : ADC : Analog value: 1024 = 12.012 (98 samples)
12/23 17:09:23>3895010 : Info : EVENT: battery#volts=12.01
12/23 17:09:23>3895417 : Info : Webserver: stop
12/23 17:09:24>3895519 : Info : WIFI : Disconnected! Reason: '(200) Beacon timeout' Connected for 19 m 19 s
12/23 17:09:24>3895521 : Info : WIFI : Set WiFi to OFF12/23 17:09:25>
12/23 17:09:25>3896855 : Info : WIFI : Set WiFi to STA
12/23 17:09:25>3896888 : Info : WIFI : Connecting SmartHome attempt #0
12/23 17:09:25>3896890 : Info : IP : Static IP : 192.168.2.3 GW: 192.168.2.1 SN: 255.255.255.0 DNS: 8.8.8.8
12/23 17:09:25>3897014 : Info : WIFI : Connecting SmartHome attempt #1
12/23 17:09:25>3897016 : Info : IP : Static IP : 192.168.2.3 GW: 192.168.2.1 SN: 255.255.255.0 DNS: 8.8.8.8
12/23 17:09:25>3897036 : Info : EVENT: WiFi#Disconnected
12/23 17:09:25>3897626 : Error : MQTT : Connection lost, state: Connection lost
12/23 17:09:26>3898096 : Info : EVENT: MQTT#Disconnected
12/23 17:09:26>12/23 17:09:27>3899338 : Info : WIFI : Disconnected! Reason: '(201) No AP found' Connected for 2193 ms
12/23 17:09:28>3899340 : Info : WIFI : Set WiFi to OFF12/23 17:09:29>
12/23 17:09:29>3900674 : Info : WIFI : Set WiFi to STA
12/23 17:09:29>3900708 : Info : WIFI : Connecting SmartHome attempt #2

...

12/23 17:09:45>3916666 : Info : WIFI : Connecting SmartHome attempt #11
12/23 17:09:45>3916668 : Info : IP : Static IP : 192.168.2.3 GW: 192.168.2.1 SN: 255.255.255.0 DNS: 8.8.8.8
12/23 17:09:45>3916687 : Info : EVENT: WiFi#Disconnected
12/23 17:09:45>3917385 : Error : ADC : No value received
12/23 17:09:46>3917982 : Info : WD : Uptime 65 ConnectFailures 0 FreeMem 18160 WiFiStatus 6
12/23 17:09:46>12/23 17:09:47>3919874 : Info : WIFI : Connected! AP: SmartHome (D8:FE:E3:75:96:8A) Ch: 11 Duration: 3102 ms
12/23 17:09:48>3919876 : Info : WIFI : Static IP: 192.168.2.3 (duel/d94d) GW12/23 17:09:49>: 192.168.2.1 SN: 255.255.255.0 duration: 103 ms
12/23 17:09:49>3919876 : Info : Webserver: start
12/23 17:09:49>3920959 : Info : EVENT: WiFi#Connected
12/23 17:09:49>3921075 : Error : MQTT : Intentional reconnect12/23 17:09:50>
12/23 17:09:50>3922143 : Error : MQTT : Failed to connect to broker
12/23 17:09:51>3922484 : Error : MQTT : Intentional reconnect12/23 17:09:52>
12/23 17:09:52>3923553 : Error : MQTT : Failed to connect to broker
12/23 17:10:22>3953271 : Error : MQTT : Intentional reconnect
12/23 17:10:22>3953326 : Info : MQTT : Connected to broker with client ID: ESPClient_CC:50:E3:0E:D9:4D
12/23 17:10:22>3953340 : Info : EVENT: MQTT#Connected
12/23 17:10:23>3956086 : Info : SW : GPIO 16 Set to 0
12/23 17:10:24>12/23 17:10:25>12/23 17:10:26>12/23 17:10:27>3959966 : Info : NTP : NTP replied: delay 10 mSec Accuracy increased by 0.782 seconds
12/23 17:10:28>3959968 : Info : Time adjusted by 38.63 msec. Wander: 0.01 msec/second
12/23 17:10:28>3959982 : Info : EVENT: Time#Set

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WIFI: Fatal exception 9 (LoadStoreAlignmentCause)

#14 Post by TD-er » 24 Dec 2019, 00:01

Thanks for reporting back.
I was a bit worried when I noticed the thread title, but this is nice to read :)

Post Reply

Who is online

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