Simple Wifi example failure

Paladin
Posts: 23
Joined: Fri Jan 13, 2017 8:45 pm

Simple Wifi example failure

Postby Paladin » Mon Mar 26, 2018 3:56 pm

I've been building up a program from the template app, and my first step was to tweak the wifi portion to reflect the simple wifi example: https://github.com/espressif/esp-idf/tr ... wifi/main.

Basically, I'm getting continual reboots since including the event handler code from the simple wifi example.

Here's the critical part of the log:

Code: Select all

/Users/alwynsmith/esp/esp-idf/components/freertos/./event_groups.c:560 (xEventGroupSetBits)- assert failed!
abort() was called at PC 0x4008af20 on core 0
0x4008af20: xEventGroupSetBits at /Users/alwynsmith/esp/esp-idf/components/freertos/./event_groups.c:560 (discriminator 1)


Backtrace: 0x4008bb10:0x3ffbcfb0 0x4008bcdf:0x3ffbcfd0 0x4008af20:0x3ffbcff0 0x400d247d:0x3ffbd010 0x400e5b69:0x3ffbd030 0x400e5ba5:0x3ffbd050
0x4008bb10: invoke_abort at /Users/alwynsmith/esp/esp-idf/components/esp32/./panic.c:648

0x4008bcdf: abort at /Users/alwynsmith/esp/esp-idf/components/esp32/./panic.c:648

0x4008af20: xEventGroupSetBits at /Users/alwynsmith/esp/esp-idf/components/freertos/./event_groups.c:560 (discriminator 1)

0x400d247d: event_handler at /Users/alwynsmith/esp/lowpower2/main/./main.c:41 (discriminator 1)

0x400e5b69: esp_event_post_to_user at /Users/alwynsmith/esp/esp-idf/components/esp32/./event_loop.c:94

0x400e5ba5: esp_event_loop_task at /Users/alwynsmith/esp/esp-idf/components/esp32/./event_loop.c:94


Rebooting...
Her'e the output log:

Code: Select all

Hard resetting via RTS pin...
MONITOR
--- idf_monitor on /dev/cu.usbserial-DN01J4DD 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4584
load:0x40078000,len:0
ho 12 tail 0 room 4
load:0x40078000,len:13176
entry 0x40078d38
I (224) cpu_start: Pro cpu up.
I (224) cpu_start: Single core mode
I (224) heap_init: Initializing. RAM available for dynamic allocation:
D (227) heap_init: New heap initialised at 0x3ffae6e0
I (233) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (239) heap_init: New heap initialised at 0x3ffb81a8
I (244) heap_init: At 3FFB81A8 len 00027E58 (159 KiB): DRAM
I (250) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (256) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (263) heap_init: New heap initialised at 0x4008db08
I (268) heap_init: At 4008DB08 len 000124F8 (73 KiB): IRAM
I (274) cpu_start: Pro cpu start user code
D (286) clk: RTC_SLOW_CLK calibration value: 3611038
V (295) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (295) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (301) intr_alloc: Connected src 46 to int 2 (cpu 0)
V (306) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (312) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xC0E
D (320) intr_alloc: Connected src 57 to int 3 (cpu 0)
V (325) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (332) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x40E
D (340) intr_alloc: Connected src 24 to int 9 (cpu 0)
I (345) cpu_start: Starting scheduler on PRO CPU.
D (350) heap_init: New heap initialised at 0x3ffe0440
D (350) heap_init: New heap initialised at 0x3ffe4350
V (360) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (360) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (360) intr_alloc: Connected src 16 to int 12 (cpu 0)
D (380) nvs: nvs_flash_init_custom partition=nvs start=9 count=6
D (390) nvs: nvs_open_from_partition misc 1
D (390) nvs: nvs_get_str_or_blob log
I (390) wifi: wifi firmware version: c202b34
I (390) wifi: config NVS flash: enabled
I (400) wifi: config nano formating: disabled
I (400) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (410) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
D (420) nvs: nvs_open_from_partition nvs.net80211 1
D (420) nvs: nvs_get opmode 1
D (430) nvs: nvs_get_str_or_blob sta.ssid
D (430) nvs: nvs_get_str_or_blob sta.mac
D (440) nvs: nvs_get sta.authmode 1
D (440) nvs: nvs_get_str_or_blob sta.pswd
D (440) nvs: nvs_get_str_or_blob sta.pmk
D (450) nvs: nvs_get sta.chan 1
D (450) nvs: nvs_get auto.conn 1
D (450) nvs: nvs_get bssid.set 1
D (460) nvs: nvs_get_str_or_blob sta.bssid
D (460) nvs: nvs_get sta.phym 1
D (460) nvs: nvs_get sta.phybw 1
D (470) nvs: nvs_get_str_or_blob sta.apsw
D (470) nvs: nvs_get_str_or_blob sta.apinfo
D (480) nvs: nvs_get sta.scan_method 1
D (480) nvs: nvs_get sta.sort_method 1
D (480) nvs: nvs_get sta.minrssi 1
D (490) nvs: nvs_get sta.minauth 1
D (490) nvs: nvs_get_str_or_blob ap.ssid
D (490) nvs: nvs_get_str_or_blob ap.mac
D (500) nvs: nvs_get_str_or_blob ap.passwd
D (500) nvs: nvs_get_str_or_blob ap.pmk
D (510) nvs: nvs_get ap.chan 1
D (510) nvs: nvs_get ap.authmode 1
D (510) nvs: nvs_get ap.hidden 1
D (520) nvs: nvs_get ap.max.conn 1
D (520) nvs: nvs_get bcn.interval 2
D (520) nvs: nvs_get ap.phym 1
D (530) nvs: nvs_get ap.phybw 1
D (530) nvs: nvs_get ap.sndchan 1
D (530) nvs: nvs_set_blob sta.mac 6
D (550) nvs: nvs_set_blob ap.mac 6
I (550) wifi: Init dynamic tx buffer num: 32
I (550) wifi: Init data frame dynamic rx buffer num: 32
I (550) wifi: Init management frame dynamic rx buffer num: 32
I (560) wifi: wifi driver task: 3ffbea48, prio:23, stack:4096
I (560) wifi: Init static rx buffer num: 10
I (570) wifi: Init dynamic rx buffer num: 32
I (570) wifi: wifi power manager task: 0x3ffc3698 prio: 21 stack: 2560
D (580) RTC_MODULE: Wi-Fi takes adc2 lock.
D (580) phy_init: loading PHY init data from application binary
D (590) nvs: nvs_open_from_partition phy 0
D (590) nvs: nvs_get cal_version 4
V (590) phy_init: phy_get_rf_cal_version: 383

D (600) nvs: nvs_get_str_or_blob cal_mac
D (600) nvs: nvs_get_str_or_blob cal_data
D (610) nvs: nvs_close 3
V (610) phy_init: register_chipv7_phy, init_data=0x3f40fa38, cal_data=0x3ffc38cc, mode=0
I (700) phy: phy_version: 383.0, 79a622c, Jan 30 2018, 15:38:06, 1, 0
I (700) wifi: mode : sta (24:0a:c4:00:a1:a8)
D (700) event: SYSTEM_EVENT_STA_START
V (700) event: enter default callback
V (700) tcpip_adapter: check: local, if=0 fn=0x400e2da8
0x400e2da8: tcpip_adapter_start_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


V (710) tcpip_adapter: call api in lwip: ret=0x0, give sem
V (720) tcpip_adapter: check: remote, if=0 fn=0x400e2da8
0x400e2da8: tcpip_adapter_start_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


V (720) event: exit default callback
I (720) wifi_event: SYSTEM_EVENT_STA_START
Configure Outputs
I (730) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0 
I (740) gpio: GPIO[27]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0 
Configure Inputs
I (750) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (760) gpio: GPIO[26]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (770) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (780) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (790) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (800) gpio: GPIO[37]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (810) gpio: GPIO[38]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (820) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
----Begin Tasks------
I (1580) wifi: n:7 0, o:1 0, ap:255 255, sta:7 0, prof:1
I (3540) wifi: state: init -> auth (b0)
I (3550) wifi: state: auth -> assoc (0)
I (3560) wifi: state: assoc -> run (10)
I (3580) wifi: connected with Wyrm Net, channel 7
D (3580) event: SYSTEM_EVENT_STA_CONNECTED, ssid:Wyrm Net, ssid_len:8, bssid:e4:f4:c6:07:4e:54, channel:7, authmode:3
V (3590) event: enter default callback
V (3590) tcpip_adapter: check: local, if=0 fn=0x400e2fd8
0x400e2fd8: tcpip_adapter_up_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


V (3600) tcpip_adapter: call api in lwip: ret=0x0, give sem
V (3600) tcpip_adapter: check: remote, if=0 fn=0x400e2fd8
0x400e2fd8: tcpip_adapter_up_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


V (3610) tcpip_adapter: check: local, if=0 fn=0x400e342c
0x400e342c: tcpip_adapter_dhcpc_start_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


D (3610) tcpip_adapter: dhcp client init ip/mask/gw to all-0
D (3620) tcpip_adapter: if0 start ip lost tmr: enter
D (3620) tcpip_adapter: if0 start ip lost tmr: no need start because netif=0x3ffc3d68 interval=120 ip=0
D (3640) tcpip_adapter: dhcp client start successfully
V (3640) tcpip_adapter: call api in lwip: ret=0x0, give sem
V (3650) tcpip_adapter: check: remote, if=0 fn=0x400e342c
0x400e342c: tcpip_adapter_dhcpc_start_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


V (3650) event: exit default callback
D (5500) tcpip_adapter: if0 dhcpc cb
D (5500) tcpip_adapter: if0 ip changed=1
D (5500) event: SYSTEM_EVENT_STA_GOT_IP, ip:192.168.1.4, mask:255.255.255.0, gw:192.168.1.1
V (5500) event: enter default callback
I (5510) event: sta ip: 192.168.1.4, mask: 255.255.255.0, gw: 192.168.1.1
V (5510) event: exit default callback
I (5520) wifi_event: SYSTEM_EVENT_STA_GOT_IP
I (5520) wifi_event: got ip:192.168.1.4

/Users/alwynsmith/esp/esp-idf/components/freertos/./event_groups.c:560 (xEventGroupSetBits)- assert failed!
abort() was called at PC 0x4008af7c on core 0
0x4008af7c: xEventGroupSetBits at /Users/alwynsmith/esp/esp-idf/components/freertos/./event_groups.c:560 (discriminator 1)


Backtrace: 0x4008bb6c:0x3ffbcfb0 0x4008bd3b:0x3ffbcfd0 0x4008af7c:0x3ffbcff0 0x400d247d:0x3ffbd010 0x400e5b71:0x3ffbd030 0x400e5bad:0x3ffbd050
0x4008bb6c: invoke_abort at /Users/alwynsmith/esp/esp-idf/components/esp32/./panic.c:648

0x4008bd3b: abort at /Users/alwynsmith/esp/esp-idf/components/esp32/./panic.c:648

0x4008af7c: xEventGroupSetBits at /Users/alwynsmith/esp/esp-idf/components/freertos/./event_groups.c:560 (discriminator 1)

0x400d247d: event_handler at /Users/alwynsmith/esp/lowpower2/main/./main.c:41 (discriminator 1)

0x400e5b71: esp_event_post_to_user at /Users/alwynsmith/esp/esp-idf/components/esp32/./event_loop.c:94

0x400e5bad: esp_event_loop_task at /Users/alwynsmith/esp/esp-idf/components/esp32/./event_loop.c:94


Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4584
load:0x40078000,len:0
ho 12 tail 0 room 4
load:0x40078000,len:13176
entry 0x40078d38
I (224) cpu_start: Pro cpu up.
I (224) cpu_start: Single core mode
I (224) heap_init: Initializing. RAM available for dynamic allocation:
D (228) heap_init: New heap initialised at 0x3ffae6e0
I (233) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
D (239) heap_init: New heap initialised at 0x3ffb81a8
I (244) heap_init: At 3FFB81A8 len 00027E58 (159 KiB): DRAM
I (250) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (256) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
D (263) heap_init: New heap initialised at 0x4008db08
I (268) heap_init: At 4008DB08 len 000124F8 (73 KiB): IRAM
I (274) cpu_start: Pro cpu start user code
D (286) clk: RTC_SLOW_CLK calibration value: 3671257
V (295) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (296) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (301) intr_alloc: Connected src 46 to int 2 (cpu 0)
V (306) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (312) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xC0E
D (320) intr_alloc: Connected src 57 to int 3 (cpu 0)
V (325) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (332) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x40E
D (340) intr_alloc: Connected src 24 to int 9 (cpu 0)
I (345) cpu_start: Starting scheduler on PRO CPU.
D (351) heap_init: New heap initialised at 0x3ffe0440
D (351) heap_init: New heap initialised at 0x3ffe4350
V (361) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args
V (361) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE
D (361) intr_alloc: Connected src 16 to int 12 (cpu 0)
D (381) nvs: nvs_flash_init_custom partition=nvs start=9 count=6
D (391) nvs: nvs_open_from_partition misc 1
D (391) nvs: nvs_get_str_or_blob log
I (391) wifi: wifi firmware version: c202b34
I (391) wifi: config NVS flash: enabled
I (401) wifi: config nano formating: disabled
I (401) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (411) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
D (421) nvs: nvs_open_from_partition nvs.net80211 1
D (421) nvs: nvs_get opmode 1
D (431) nvs: nvs_get_str_or_blob sta.ssid
D (431) nvs: nvs_get_str_or_blob sta.mac
D (441) nvs: nvs_get sta.authmode 1
D (441) nvs: nvs_get_str_or_blob sta.pswd
D (441) nvs: nvs_get_str_or_blob sta.pmk
D (451) nvs: nvs_get sta.chan 1
D (451) nvs: nvs_get auto.conn 1
D (451) nvs: nvs_get bssid.set 1
D (461) nvs: nvs_get_str_or_blob sta.bssid
D (461) nvs: nvs_get sta.phym 1
D (461) nvs: nvs_get sta.phybw 1
D (471) nvs: nvs_get_str_or_blob sta.apsw
D (471) nvs: nvs_get_str_or_blob sta.apinfo
D (481) nvs: nvs_get sta.scan_method 1
D (481) nvs: nvs_get sta.sort_method 1
D (481) nvs: nvs_get sta.minrssi 1
D (491) nvs: nvs_get sta.minauth 1
D (491) nvs: nvs_get_str_or_blob ap.ssid
D (491) nvs: nvs_get_str_or_blob ap.mac
D (501) nvs: nvs_get_str_or_blob ap.passwd
D (501) nvs: nvs_get_str_or_blob ap.pmk
D (511) nvs: nvs_get ap.chan 1
D (511) nvs: nvs_get ap.authmode 1
D (511) nvs: nvs_get ap.hidden 1
D (521) nvs: nvs_get ap.max.conn 1
D (521) nvs: nvs_get bcn.interval 2
D (521) nvs: nvs_get ap.phym 1
D (531) nvs: nvs_get ap.phybw 1
D (531) nvs: nvs_get ap.sndchan 1
D (531) nvs: nvs_set_blob sta.mac 6
D (551) nvs: nvs_set_blob ap.mac 6
I (551) wifi: Init dynamic tx buffer num: 32
I (551) wifi: Init data frame dynamic rx buffer num: 32
I (551) wifi: Init management frame dynamic rx buffer num: 32
I (561) wifi: wifi driver task: 3ffbea48, prio:23, stack:4096
I (561) wifi: Init static rx buffer num: 10
I (571) wifi: Init dynamic rx buffer num: 32
I (571) wifi: wifi power manager task: 0x3ffc3698 prio: 21 stack: 2560
D (581) RTC_MODULE: Wi-Fi takes adc2 lock.
D (581) phy_init: loading PHY init data from application binary
D (591) nvs: nvs_open_from_partition phy 0
D (591) nvs: nvs_get cal_version 4
V (591) phy_init: phy_get_rf_cal_version: 383

D (601) nvs: nvs_get_str_or_blob cal_mac
D (601) nvs: nvs_get_str_or_blob cal_data
D (611) nvs: nvs_close 3
V (611) phy_init: register_chipv7_phy, init_data=0x3f40fa38, cal_data=0x3ffc38cc, mode=0
I (701) phy: phy_version: 383.0, 79a622c, Jan 30 2018, 15:38:06, 1, 0
I (701) wifi: mode : sta (24:0a:c4:00:a1:a8)
D (701) event: SYSTEM_EVENT_STA_START
V (701) event: enter default callback
V (711) tcpip_adapter: check: local, if=0 fn=0x400e2da8
0x400e2da8: tcpip_adapter_start_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


V (711) tcpip_adapter: call api in lwip: ret=0x0, give sem
V (721) tcpip_adapter: check: remote, if=0 fn=0x400e2da8
0x400e2da8: tcpip_adapter_start_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


V (721) event: exit default callback
I (731) wifi_event: SYSTEM_EVENT_STA_START
Configure Outputs
I (731) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0 
I (741) gpio: GPIO[27]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0 
Configure Inputs
I (751) gpio: GPIO[25]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (761) gpio: GPIO[26]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (771) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (781) gpio: GPIO[35]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (791) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (801) gpio: GPIO[37]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (811) gpio: GPIO[38]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (821) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
----Begin Tasks------
I (1581) wifi: n:7 0, o:1 0, ap:255 255, sta:7 0, prof:1
I (3541) wifi: state: init -> auth (b0)
I (3551) wifi: state: auth -> assoc (0)
I (3561) wifi: state: assoc -> run (10)
I (3591) wifi: connected with Wyrm Net, channel 7
D (3591) event: SYSTEM_EVENT_STA_CONNECTED, ssid:Wyrm Net, ssid_len:8, bssid:e4:f4:c6:07:4e:54, channel:7, authmode:3
V (3601) event: enter default callback
V (3601) tcpip_adapter: check: local, if=0 fn=0x400e2fd8
0x400e2fd8: tcpip_adapter_up_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


V (3601) tcpip_adapter: call api in lwip: ret=0x0, give sem
V (3611) tcpip_adapter: check: remote, if=0 fn=0x400e2fd8
0x400e2fd8: tcpip_adapter_up_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


V (3621) tcpip_adapter: check: local, if=0 fn=0x400e342c
0x400e342c: tcpip_adapter_dhcpc_start_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


D (3621) tcpip_adapter: dhcp client init ip/mask/gw to all-0
D (3631) tcpip_adapter: if0 start ip lost tmr: enter
D (3631) tcpip_adapter: if0 start ip lost tmr: no need start because netif=0x3ffc3d68 interval=120 ip=0
D (3641) tcpip_adapter: dhcp client start successfully
V (3651) tcpip_adapter: call api in lwip: ret=0x0, give sem
V (3651) tcpip_adapter: check: remote, if=0 fn=0x400e342c
0x400e342c: tcpip_adapter_dhcpc_start_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


V (3661) event: exit default callback
Here's my code:

Code: Select all

#include "freertos/FreeRTOS.h"
#include "esp_wifi.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_event_loop.h"
#include "nvs_flash.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "freertos/queue.h"

/* GPIO Setup */
#define GPIO_OUTPUT_PIN_SEL 0x0008004000 //set pins 14, 27 to output
#define GPIO_INPUT_PIN_SEL  0xFC06000000 //set pins 25,26,34,35,36,37,38,39 to input
#define ESP_INTR_FLAG_DEFAULT 0
#define HIGH 1
#define LOW 0
#define TRUE 1
#define FALSE 0

/* Event Group */
static EventGroupHandle_t wifi_event_group;
const int CONNECTED_BIT = BIT0;
static const char *EVENT_TAG = "wifi_event";

esp_err_t event_handler(void *ctx, system_event_t *event)
{
    switch(event->event_id)
    {
        case SYSTEM_EVENT_STA_START:
            ESP_LOGI(EVENT_TAG, "SYSTEM_EVENT_STA_START");
	        esp_wifi_connect();
            break;

        case SYSTEM_EVENT_STA_GOT_IP:
            ESP_LOGI(EVENT_TAG, "SYSTEM_EVENT_STA_GOT_IP");
	        ESP_LOGI(EVENT_TAG, "got ip:%s\n",
		    ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip));
		    xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
            break;

        case SYSTEM_EVENT_STA_DISCONNECTED:
            ESP_LOGI(EVENT_TAG, "SYSTEM_EVENT_STA_DISCONNECTED");
            xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
	        esp_wifi_connect();
            break;

        default:
            break;
    }
    return ESP_OK;
}

static void initialize_wifi(void)
{
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
    ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
    ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
    wifi_config_t sta_config = {
        .sta = {
            .ssid = "myssid",
            .password = "mypassword",
            .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() );
}

void app_main(void)
{
    nvs_flash_init();
    tcpip_adapter_init();
    wifi_event_group = xEventGroupCreate();
    initialize_wifi();

    gpio_config_t io_conf;

    printf("Configure Outputs\n");
    io_conf.intr_type = GPIO_PIN_INTR_DISABLE;      //disable interrupt
    io_conf.mode = GPIO_MODE_OUTPUT;                //set as output mode
    io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;     //bit mask of the pins that you want to set,e.g.GPIO 27
    io_conf.pull_down_en = 1;                       //disable pull-down mode
    io_conf.pull_up_en = 0;                         //disable pull-up mode
    gpio_config(&io_conf);                          //configure GPIO with the given settings

    printf("Configure Inputs\n");
    io_conf.intr_type = GPIO_PIN_INTR_DISABLE;      //disable interrupt
    io_conf.mode = GPIO_MODE_INPUT;                 //set as input mode
    io_conf.pin_bit_mask = GPIO_INPUT_PIN_SEL;      //bit mask of the pins that you want to set
    io_conf.pull_down_en = 0;                       //disable pull-down mode
    io_conf.pull_up_en = 0;                         //disable pull-up mode
    gpio_config(&io_conf);                          //configure GPIO with the given settings
    printf("----Begin Tasks------\n");

    while (true) {
        vTaskDelay(1000 / portTICK_PERIOD_MS);
        printf("Still alive!\r");
    }
}
Last edited by Paladin on Mon Mar 26, 2018 7:20 pm, edited 1 time in total.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Simple Wifi example failure

Postby fly135 » Mon Mar 26, 2018 4:34 pm

Is this in your code somewhere?

wifi_event_group = xEventGroupCreate();

Paladin
Posts: 23
Joined: Fri Jan 13, 2017 8:45 pm

Re: Simple Wifi example failure

Postby Paladin » Mon Mar 26, 2018 7:14 pm

Oh geez... :oops: . It is now. Thank you!

On to bigger and better bugs....

Paladin
Posts: 23
Joined: Fri Jan 13, 2017 8:45 pm

Re: Simple Wifi example failure

Postby Paladin » Mon Mar 26, 2018 7:34 pm

Which brings me to the bug I was actually after...because it matches the problem in my main project.
Adding the event handler, per the simple wi-fi example is causing the following snippet of repeated output:

Code: Select all

I (1940) wifi: n:10 0, o:1 0, ap:255 255, sta:10 0, prof:1
I (3910) wifi: state: init -> auth (b0)
I (4910) wifi: state: auth -> init (2)
I (4910) wifi: n:10 0, o:10 0, ap:255 255, sta:10 0, prof:1
D (4910) event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:Wyrm Net, ssid_len:8, bssid:e4:f4:c6:07:4e:54, reason:2
V (4920) event: enter default callback
V (4920) tcpip_adapter: check: local, if=0 fn=0x400e30d4
0x400e30d4: tcpip_adapter_down_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071


D (4930) tcpip_adapter: if0 start ip lost tmr: enter
D (4930) tcpip_adapter: if0 start ip lost tmr: no need start because netif=0x3ffc3d8c interval=120 ip=0
V (4940) tcpip_adapter: call api in lwip: ret=0x0, give sem
V (4950) tcpip_adapter: check: remote, if=0 fn=0x400e30d4
0x400e30d4: tcpip_adapter_down_api at /Users/alwynsmith/esp/esp-idf/components/tcpip_adapter/./tcpip_adapter_lwip.c:1071

Who is online

Users browsing this forum: No registered users and 116 guests