tuanpmt / esp32-mqtt

ESP32 MQTT sample project for
https://github.com/tuanpmt/espmqtt
Apache License 2.0
180 stars 51 forks source link

ESP32 DevC board constant reboot #2

Open lakidd opened 8 years ago

lakidd commented 8 years ago

Hi, I've tried to install the app onto my devboard (having set things like the MQTT server, ssid and password and I get this constantly. My WiFi is mac filtered but it doesn't seem to be getting even that far (as in joining the network). It appears to be crashing at this line

strcpy(cfg.sta.ssid, WIFI_SSID);
strcpy(cfg.sta.password, WIFI_PASS);

But both are set

Any idea how to troubleshoot ?

ets Jun  8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3ffc0000,len:0
load:0x3ffc0000,len:920
load:0x40078000,len:2724
ho 0 tail 12 room 4
load:0x40098000,len:508
entry 0x40098118
I (266) heap_alloc_caps: Initializing heap allocator:
I (267) heap_alloc_caps: Region 19: 3FFB4E70 len 0002B190 tag 0
I (283) heap_alloc_caps: Region 25: 3FFE8000 len 00018000 tag 1
I (344) cpu_start: Pro cpu up.
I (378) cpu_start: Starting app cpu, entry point is 0x4008094c
I (0) cpu_start: App cpu up.
rtc v112 Sep 22 2016 16:08:39art user code
XTAL 40M
[0;32mI (630) cpu_start: Starting scheduler on PRO CPU.
I (193) cpu_start: Starting scheduler on APP CPU.
[APP] Startup..
[APP] Free memory: 258408 bytes
[APP] SDK version: 1.0.0(b95f5cf), Build time: 2016-Oct-09_11:04:38_AEDT
[APP] Start, connect to Wifi network: xxx ..
Guru Meditation Error of type LoadProhibited occurred on core   0. Exception was unhandled.
Register dump:
PC      :  400d545e  PS      :  00060330  A0      :  800d414f  A1      :  3ffb6c50
A2      :  00000001  A3      :  3ffb8e8c  A4      :  3ffb27ec  A5      :  00000000
A6      :  00000003  A7      :  00000001  A8      :  00000008  A9      :  3ffb6c30
A10     :  3ffb8e8c  A11     :  400d0af8  A12     :  00000000  A13     :  3f401820
A14     :  00000001  A15     :  00000007  SAR     :  0000001d  EXCCAUSE:  0000001c
EXCVADDR:  0000000c  LBEG    :  4000c46c  LEND    :  4000c477  LCOUNT  :  ffffffff
Rebooting...
ets Jun  8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3ffc0000,len:0
load:0x3ffc0000,len:920
load:0x40078000,len:2724
ho 0 tail 12 room 4
load:0x40098000,len:508
entry 0x40098118
I (266) heap_alloc_caps: Initializing heap allocator:
I (267) heap_alloc_caps: Region 19: 3FFB4E70 len 0002B190 tag 0
I (283) heap_alloc_caps: Region 25: 3FFE8000 len 00018000 tag 1
I (344) cpu_start: Pro cpu up.
I (378) cpu_start: Starting app cpu, entry point is 0x4008094c
I (0) cpu_start: App cpu up.
I (471) cpu_start: Pro cpu start user code
rtc v112 Sep 22 2016 16:08:39
XTAL 40M
[0;32mI (630) cpu_start: Starting scheduler on PRO CPU.
I (193) cpu_start: Starting scheduler on APP CPU.
[APP] Startup..
[APP] Free memory: 258408 bytes
[APP] SDK version: 1.0.0(b95f5cf), Build time: 2016-Oct-09_11:04:38_AEDT
[APP] Start, connect to Wifi network: xxx ..
Guru Meditation Error of type LoadProhibited occurred on core   0. Exception was unhandled.
Register dump:
PC      :  400d545e  PS      :  00060330  A0      :  800d414f  A1      :  3ffb6c50
A2      :  00000001  A3      :  3ffb8e8c  A4      :  3ffb27ec  A5      :  00000000
A6      :  00000003  A7      :  00000001  A8      :  00000008  A9      :  3ffb6c30
A10     :  3ffb8e8c  A11     :  400d0af8  A12     :  00000000  A13     :  3f401820
A14     :  00000001  A15     :  00000007  SAR     :  0000001d  EXCCAUSE:  0000001c
EXCVADDR:  0000000c  LBEG    :  4000c46c  LEND    :  4000c477  LCOUNT  :  ffffffff
Rebooting...
ESP32DE commented 8 years ago

not sure, but are they not CONST ? ( fixed lenght / difference lenght)

lakidd commented 8 years ago

I've done some more troubleshooting and it's not that. As soon as we get to INFO("[APP] Start, connect to Wifi network: %s ..\n", WIFI_SSID); it crashes straight after. It appears to be unrelated to this bit of code (commented it out same result) but I'm an RTOS newb as to what that might be.

ESP32DE commented 8 years ago

how you set up your sta (wifi)

lakidd commented 8 years ago

sorry I don't understand ? Even if I comment out the above line I get the same result.

WIFI_SSID is defined as #define WIFI_SSID "xxxx"

I've tried replacing WIFI_SSID with "xxxx" in the INFO line above with the same result.

Does this code work for you ?

ESP32DE commented 8 years ago

/* station mode! ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); wifi_config_t sta_config = { .sta = { .ssid = "OneTwoThreeFourFive", .password = "NoPublicHereNotShow", .bssid_set = false } }; ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &sta_config) ); ESP_ERROR_CHECK( esp_wifi_start() ); ESP_ERROR_CHECK( esp_wifi_connect() ); */

/* ap mode */

ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_AP) ) ;
wifi_config_t ap_config = {
    .ap = {
        .ssid           = "OneTwoThreeFourFive\0",
        .password       = "NoPublicHereNotShow",
        /*.bssid_set  = false,*/
        .ssid_len       = 0,
        /* .channel        = WIFI_COUNTRY_EU, */  
         .authmode       = WIFI_AUTH_WPA2_PSK,
        /* .ssid_hidden    = , */
        .max_connection =  10
        /* .beacon_interval=  */

    }
ESP32DE commented 8 years ago

https://github.com/tuanpmt/esp32-mqtt/blob/master/main/app_main.c#L112 https://github.com/tuanpmt/esp32-mqtt/blob/master/main/include/user_config.sample.h#L29 sry for confusing you are right. not sure why this is the setup for wifi is done in top code example ( esp-idf )

lakidd commented 8 years ago

Yes exactly, it's crashing after a few lines of printing basically debug info, not much else. Can you get it to work ?

ESP32DE commented 8 years ago

which esp-idf version ( commits nr ) you use? i know i have one problem with the newest in tcp server i used the preview version for this.

just in time i can't help you with do on a module, i am sitting in wrong place, earliest on monday.

lakidd commented 8 years ago

no worries, thanks (rudi ?) using the latest esp-idf

ESP32DE commented 8 years ago

yes ;-) sry can you test with an early version? best wishes rudi ;-) ;-) ED: i remember me, that the last update on wifi lib have a change ..

lakidd commented 8 years ago

so I just updated to the latest library files and now get this

[APP] Start, connect to Wifi network: xxx ..
/Users/lakidd1/esp32/esp-idf/components/freertos/./queue.c:603 (xQueueGenericSend)- assert failed!
Guru Meditation Error: Core   0 panic'ed.
Register dump:
PC      : Guru Meditation Error of type LoadProhibited occurred on core   0. Exception was unhandled.
Register dump:
PC      :  40083b06  PS      :  00060033  A0      :  80083d29  A1      :  3ffb6a60
A2      :  00000000  A3      :  00000002  A4      :  00000000  A5      :  00000000
A6      :  3f401158  A7      :  3ff4001c  A8      :  0000007d  A9      :  3ff4001c
A10     :  3ff4001c  A11     :  3f4002f4  A12     :  00000000  A13     :  3ffb6ac0
A14     :  00000000  A15     :  3f40126c  SAR     :  00000015  EXCCAUSE:  0000001c
EXCVADDR:  00000004  LBEG    :  4000c2e0  LEND    :  4000c2f6  LCOUNT  :  00000000
Rebooting..

Yes, so might need to back an version thanks

ESP32DE commented 8 years ago

can you see a change in your building messages? ( suspicious unknown ) warning..

ESP32DE commented 8 years ago

https://github.com/espressif/esp-idf/blob/master/components/freertos/queue.c#L603

ESP32DE commented 8 years ago

not sure where the while(1) was removed https://github.com/tuanpmt/esp32-mqtt/commit/9a180aab325fe4af116f0aa57d151d6581b47fe2

perhabs it can be a task error ( not combine with this remove ) ..small change in the esp-idf / lib

this is the moment of reboot? https://github.com/tuanpmt/esp32-mqtt/blob/master/main/app_main.c#L118

lakidd commented 8 years ago

OK I got it working but it was significant surgery to the existing code. I took the wifi init code from the http example in esp-idf and replaced the code between L112 and L118. Works now but not sure why...I suspect esp_wifi_set mode and others were throwing exceptions which weren't being handled and now are. @tuanpmt which version of esp-idf did you build this with ? How to I contribute my changes back (if you want them) ?

Edit: Ah this is all fixed in the dev branch. My bad

vanthome commented 7 years ago

I had the same issue, in my case the stack depth of a task was to small.

tuanpmt commented 7 years ago

@esp32de user need to copy user_config.sample.h to user_config.local.h and compile project with some of the information does not want to public (.gitingore will ignore user_config.local.h)

I'm updating this library work with select api and outbox queue, but need to try with Arduino for ESP8266 first. As @vanthome said, Please try increasing the stack size