B4R Question ESP8266EX crash when using wifi (exception 3)

tzfpg

Active Member
Licensed User
Longtime User
i write a simple code to connect to wifi ap,but when esp try to connect wifi, esp will reset.

below is error message:
B4X:
load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld

AppStart
ConnectToNetwork
Trying to connect to: TEST password: TEST123456789

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (3):
epc1=0x4010078c epc2=0x00000000 epc3=0x00000000 excvaddr=0x4006eac1 depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffffb10 end: 3fffffc0 offset: 0190
3ffffca0:  feefeffe feefeffe feefeffe feefeffe 
3ffffcb0:  feefeffe feefeffe feefeffe feefeffe 
3ffffcc0:  feefeffe feefeffe feefeffe 3ffffe70 
3ffffcd0:  0000049c 0000049c 00000020 40100974 
3ffffce0:  feefeffe feefeffe feefeffe feefeffe 
3ffffcf0:  00000000 400042db 000000fd 40100bc4 
3ffffd00:  40004b31 00001000 000000fd 401002f0 
3ffffd10:  40105b24 feefeffe feefeffe 4022ebe1 
3ffffd20:  401001cd 4022eccb 3ffef69c 0000049c 
3ffffd30:  000000fd 3ffffe70 3ffef69c 4022ecae 
3ffffd40:  ffffff00 55aa55aa 0000000b 00000020 
3ffffd50:  00000020 000000ac 000000ac aa55aa55 
3ffffd60:  000000ff 4022f1ae 3ffef69c 3ffef69c 
3ffffd70:  000000ff 0000017a 0000017a 401006bb 
3ffffd80:  401001cd 00000001 3ffef6ac 4022f3ce 
3ffffd90:  00000005 3ffef69c 000000ff 3ffffe70 
3ffffda0:  3ffffe90 3ffef6d3 0000000b 00000020 
3ffffdb0:  3ffef75c 3ffffed1 00000001 4022f47e 
3ffffdc0:  3ffffe70 4023aa30 00000000 0000000d 
3ffffdd0:  3ffefa9c 3ffffe90 3fff59d4 4022f44d 
3ffffde0:  3ffef69c 4022f4b4 3ffe84cc 3ffe863c 
3ffffdf0:  402020ca 3ffe863c 3ffe8641 4020201f 
3ffffe00:  4d494445 00005841 00000000 3fff0760 
3ffffe10:  3fff0730 0000000a 00000000 40209880 
3ffffe20:  3631686b 64353340 74323134 38373834 
3ffffe30:  00000000 4bc6a7f0 249ba5e3 00000000 
3ffffe40:  00000000 00000000 4bc6a7f0 00000000 
3ffffe50:  3fff0730 00000004 4010026c 00000354 
3ffffe60:  021f8000 007eecb4 000a0d03 40203ef1 
3ffffe70:  54534554 00000000 00000000 3fffff00 
3ffffe80:  3ffffed0 0000000a 00000000 40202da8 
3ffffe90:  54534554 34333231 38373635 40200039 
3ffffea0:  00000000 4bc6a7f0 7d2f1a9f 00000000 
3ffffeb0:  00000000 00000000 4bc6a7f0 00000000 
3ffffec0:  3ffffed0 00000004 40100274 0000005b 
3ffffed0:  00000000 00000066 3ffe8681 00000002 
3ffffee0:  00000004 00000000 3ffee388 00000001 
3ffffef0:  4023b6d0 3ffee366 3ffe8655 00000000 
3fffff00:  0000005b 00000000 3ffee388 40201753 
3fffff10:  3ffe863c 00000066 4023b6b8 00000065 
3fffff20:  3ffe863c 00000066 00000001 00000000 
3fffff30:  3fffff60 00000065 3fffff68 402017ac 
3fffff40:  3fffff60 00000065 3fffff68 4020161d 
3fffff50:  4023b6ac 00000065 3ffe8641 00000521 
3fffff60:  3ffe8641 00000001 3ffe863c 40100901 
3fffff70:  3fffdad0 00000000 3ffee3e0 3ffee518 
3fffff80:  3fffdad0 00000000 3ffee348 402016aa 
3fffff90:  feefeffe 00000000 3ffee4d8 402017dc 
3fffffa0:  feefeffe feefeffe feefeffe 40202ebc 
3fffffb0:  feefeffe feefeffe 3ffe84e4 40100bf9 
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

 ets Jan  8 2013,rst cause:1, boot mode:(3,6)
load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac

here is my project
B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 600
#End Region

Sub Process_Globals
    Public Serial1 As Serial
    Public WiFi As ESP8266WiFi

End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    ConnectToNetwork
End Sub

Public Sub ConnectToNetwork
    Log("ConnectToNetwork")
    Dim SSID As String = "TEST"
    Dim Password As String = "TEST123456789"
    Log("Trying to connect to: ", SSID, " password: ", Password)
    If WiFi.Connect2(SSID, Password) Then
        Log("Connected successfully to: ", SSID)
        Log("Local IP: ", WiFi.LocalIp)
        RunNative("SetSTA", Null)
    Else
        Log("Failed to connect.")
    End If
End Sub

#if C
void SetSTA(B4R::Object* o) {
   WiFi.mode(WIFI_STA);
}
#End If

please anyone help me!

thanks!
 

tzfpg

Active Member
Licensed User
Longtime User
Strange error. What happens if you set the wrong SSID or wrong password?

same problem
B4X:
Exception (3):
epc1=0x4010078c epc2=0x00000000 epc3=0x00000000 excvaddr=0x4006eac9 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3ffffb10 end: 3fffffc0 offset: 01a0
3ffffcb0:  feefeffe feefeffe 00000005 00000000 
3ffffcc0:  00000020 4010017c feefeffe 3ffffe70 
3ffffcd0:  0000049c 0000049c 00000020 4010097c 
3ffffce0:  3ffec4e0 feefeffe 401020c3 3ffec4e0 
3ffffcf0:  00000000 400042db 000000fd 40100bd4 
3ffffd00:  40004b31 00001000 000000fd 401002f0 
3ffffd10:  40105c1c 401047bf ffffffea 4022e46d 
3ffffd20:  401001cd 4022e557 3ffef514 0000049c 
3ffffd30:  000000fd 3ffffe70 3ffef514 4022e53a 
3ffffd40:  ffffff00 55aa55aa 0000000b 00000020 
3ffffd50:  00000020 000000ac 000000ac aa55aa55 
3ffffd60:  000000ff 4022ea3a 3ffef514 3ffef514 
3ffffd70:  000000ff 00000148 00000148 401006bc 
3ffffd80:  401001cd 00000001 3ffef524 4022ec5a 
3ffffd90:  00000005 3ffef514 000000ff 3ffffe70 
3ffffda0:  3ffffe90 3ffef54b 0000000b 00000020 
3ffffdb0:  3ffef5d4 3ffffed1 00000001 4022ed0a 
3ffffdc0:  3ffffe70 4023a2c0 00000000 0000000d 
3ffffdd0:  3ffef914 3ffffe90 3fff584c 4022ecd9 
3ffffde0:  3ffef514 4022ed40 3ffe84cc 3ffe863c 
3ffffdf0:  4020207a 3ffe863c 3ffe8641 40201fcf 
3ffffe00:  4d494445 00005841 00000000 3fff0760 
3ffffe10:  3fff0730 0000000a 00000000 40209880 
3ffffe20:  3631686b 64353340 74323134 38373834 
3ffffe30:  00000000 4bc6a7f0 249ba5e3 00000000 
3ffffe40:  00000000 00000000 4bc6a7f0 00000000 
3ffffe50:  3fff0730 00000004 4010026c 00000354 
3ffffe60:  021f8000 007eecb4 000a0d03 40203ce9 
3ffffe70:  54534554 00000000 00000000 3fffff00 
3ffffe80:  3ffffed0 0000000a 00000000 40202e5b 
3ffffe90:  54534554 34333231 38373635 40200039 
3ffffea0:  00000000 4bc6a7f0 828f5c28 00000000 
3ffffeb0:  00000000 00000000 4bc6a7f0 00000000 
3ffffec0:  3ffffed0 00000004 40100274 00000058 
3ffffed0:  00000000 00000066 3ffe8681 00000002 
3ffffee0:  00000004 00000000 3ffee388 00000001 
3ffffef0:  4023af60 3ffee366 3ffe8655 00000000 
3fffff00:  00000058 00000000 3ffee388 40201753 
3fffff10:  3ffe863c 00000066 4023af48 00000065 
3fffff20:  3ffe863c 00000066 00000001 00000000 
3fffff30:  3fffff60 00000065 3fffff68 402017ac 
3fffff40:  3fffff60 00000065 3fffff68 4020161d 
3���
 
Upvote 0

candide

Active Member
Licensed User
i am using something like that and it is working:
B4X:
Public Sub ConnectToNetwork
    WiFi.Disconnect

    If GetStoredData = 1 Then
    'read settings from EEPROM
          Dim SSID As String = bc.StringFromBytes(GStore1.slot0) 'ignore
        Dim Password As String = bc.StringFromBytes(GStore1.slot1) 'ignore" '
'            Log("Trying to connect to: ", SSID, " password: ", Password)
        If WiFi.Connect2(SSID,Password) Then 'Objects(0), Objects(1)) Then
            Log("Connected successfully to: ", GStore1.slot0)
            Log("Local IP: ", WiFi.LocalIp)
            StopAP
            ConnectToMqtt
            softclock.StartRTC
       Else
            Log("WIFI Failed to connect.")
      End If
    Else
        Log("Network data not found.")
    End If
End Sub

- can you remove " RunNative("SetSTA", Null)"

- can you change SSID to a not existing SSID ? and try again

- can you try to connect on a network without key ? (on a mobile making gateway it is easy to test)

normally it should work...
 
Upvote 0
Top