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

Wifi + SSL + Zigbee Crash (TZ-1130) #427

Open
kioelka opened this issue Sep 12, 2024 · 3 comments
Open

Wifi + SSL + Zigbee Crash (TZ-1130) #427

kioelka opened this issue Sep 12, 2024 · 3 comments
Labels

Comments

@kioelka
Copy link

kioelka commented Sep 12, 2024

Question

ESP_IDF v 5.1.3
chip ESP32C6 8MB SPI flash

I'm trying to add zigbee function to project.
It works only if wifi isn't connected to AP, else app crashes in ssl task when it starts to connect to server or when it gets white IP address from api.ipify.org

I (5601) zigbee.c:0219 : Network(0x239d) closed, devices joining not allowed.
ZBOSS: commissioning/bdb/zdo_commissioning_bdb.c:549   COMMISSIONING_STOP: app signal 6 comm status 0
I (5611) zigbee.c:0176 : Device started up in non factory-reset mode
I (5621) zigbee.c:0181 : Device rebooted
I (6631) contikiIntegration.c:0393 : INFO: msID: 1, cmd: 05
I (7131) flash.c:0234 : WARNING: getKoefs start!
I (7131) flash.c:0504 : Blob "koefs" length unknown, detect it
I (7131) flash.c:0251 : pKoefs.crc: 0x7c9ec761, getKoefsCRC_CH32:  0x7c9ec761
I (7141) flash.c:0253 : Koefs CRC=0x7c9ec761 OK
I (7141) esp-efuse.c:0059 : xtest efuse: bitsWritten: 1
I (7151) settings.c:0058 : Got UTC time 0,convert to 0 and save RAM
I (7161) settings.c:0058 : Got UTC time 0,convert to 0 and save RAM
I (7171) settings.c:0047 : Got Local time 0,convert to 0 and save KOEFS
I (7181) settings.c:0047 : Got Local time 0,convert to 0 and save KOEFS
I (7181) settings.c:0159 : setControlTypeCheck 2
I (7191) settings.c:0174 : reset PRH
I (7191) settings.c:0192 : coolMode 128 controlType 2
I (7201) settings.c:0195 : return fail
I (7211) esp-efuse.c:0059 : xtest efuse: bitsWritten: 1
I (7211) flash.c:0286 : xtest efuse 0
I (7221) flash.c:0519 : ERROR: Get from nvs error: ESP_ERR_NVS_NOT_FOUND
I (7231) flash.c:0523 : ERROR: Get from nvs backup error: ESP_ERR_NVS_NOT_FOUND
I (8151) wifi:ap channel adjust o:1,1 n:2,1
I (8151) wifi:new:<2,0>, old:<1,1>, ap:<2,1>, sta:<2,0>, prof:1
I (8161) wifi:(connect)dot11_authmode:0x3, pairwise_cipher:0x3, group_cipher:0x3
I (8481) wifi:state: init -> auth (b0)
I (8491) wifi:state: auth -> assoc (0)
I (8491) wifi:state: assoc -> run (10)
I (8491) wifi:(trc)phytype:CBW20-SGI, snr:49, maxRate:144, highestRateIdx:0
I (8491) wifi:(trc)rate(S-MCS7, schedIdx:0), ampdu(rate:S-MCS7, schedIdx(0, stop:8)), snr:49, ampduState:wait operational
I (8501) wifi:ifidx:0, rssi:-47, nf:-96, phytype(0x3, CBW20-SGI), phymode(0x3, 11bgn), max_rate:1440, he:0
I (8511) wifi:max ampdu length exponent:3(65535 bytes), mmss:5(4 us)
W (8591) wifi:[ADDBA]rx delba, code:39, delete tid:0
W (8591) wifi:[ADDBA]rx delba, code:39, delete tid:5
W (8591) wifi:[ADDBA]rx delba, code:39, delete tid:6
W (8591) wifi:[ADDBA]rx delba, code:39, delete tid:7
W (8601) wifi:<ba-add>idx:0, ifx:0, tid:0, TAHI:0x100864d, TALO:0x720e6ed6, (ssn:3, win:64, cur_ssn:3), CONF:0xc0000005
I (8621) wifi:(extcap)mbssid:0, enhanced_mbssid_advertise:0, complete_nontxbssid_profiles:0, twt_responder: 0
I (8621) wifi:connected with Direct, aid = 2, channel 2, BW20, bssid = d6:6e:0e:72:4d:86
I (8621) wifi:cipher(pairwise:0x3, group:0x3), pmf:0, security:WPA2-PSK, phy:11bgn, rssi:-47
I (8631) wifi:pm start, type: 2, itwt_start:0

I (8641) wifi:pm start, type:2, aid:0x2, trans-BSSID:d6:6e:0e:72:4d:86, BSSID[5]:0x86, mbssid(max-indicator:0, index:0), he:0
I (8651) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (8661) wifi:set rx beacon pti, rx_bcn_pti: 10, bcn_timeout: 25000, mt_pti: 10, mt_time: 10000
I (8661) wifi:[ADDBA]TX addba request, tid:0, dialogtoken:1, bufsize:64, A-MSDU:0(not supported), policy:1(IMR), ssn:0(0x0)
I (8681) wifi:[ADDBA]TX addba request, tid:7, dialogtoken:2, bufsize:64, A-MSDU:0(not supported), policy:1(IMR), ssn:0(0x20)
I (8691) wifi:[ADDBA]TX addba request, tid:5, dialogtoken:3, bufsize:64, A-MSDU:0(not supported), policy:1(IMR), ssn:0(0x0)
I (8701) wifi.c:0355 : Connected to Direct
I (8711) wifi:[ADDBA]RX addba response, status:0, tid:0/tb:1(0xa1), bufsize:64, batimeout:0, txa_wnd:64
I (8711) wifi:[ADDBA]RX addba response, status:0, tid:7/tb:1(0xa1), bufsize:64, batimeout:0, txa_wnd:64
I (8721) wifi:[ADDBA]RX addba response, status:0, tid:5/tb:1(0xa1), bufsize:64, batimeout:0, txa_wnd:64
I (8731) wifi:AP's beacon interval = 102400 us, DTIM period = 1
W (8741) wifi:<ba-add>idx:1, ifx:0, tid:6, TAHI:0x100864d, TALO:0x720e6ed6, (ssn:0, win:64, cur_ssn:0), CONF:0xc0006005
I (9131) functions.c:0674 : current settings time 1/1/0 0:0:0
I (9131) functions.c:0678 : current timetable time 1/1/0 0:0:0
I (9701) esp_netif_handlers: sta ip: 192.168.3.98, mask: 255.255.255.0, gw: 192.168.3.1
I (9701) wifi.c:1079 : STOP STA CONNECT TIMER
I (9701) wifi.c:1085 : STOP STA CONNECT TIMER: DONE
I (9711) wifi.c:0397 : IP_EVENT: IP_EVENT_STA_GOT_IP
I (9711) wifi.c:0409 : IP_EVENT: got ip: 192.168.3.98
I (9721) flash.c:0811 : Set nvs wifiResetCount done: 0
I (9731) flash.c:0831 : Set nvs backup wifiResetCount done: 0
I (9731) wifi.c:1004 : START MULTICAST TIMER
I (9741) flash.c:0758 : Get from nvs telnetLogOn done: 1
I (9751) telnet_log.c:0075 : INFO: telnetTask
I (9751) wifi.c:0491 : ##### Inited debugInfoTimer not requested
I (9761) esp-cloud.c:0273 : Seeding the random number generator
I (9771) esp-cloud.c:0282 : Setting up the SSL/TLS structure...
I (9781) esp-cloud.c:0871 : START RECEIVE TIMER: 9000 ms
I (9781) esp-cloud.c:0875 : START RECEIVE TIMER: STARTED
I (9791) esp-cloud.c:0346 : Connecting to p1:9030... freeHeap 149636
I (9801) telnet_log.c:0087 : INFO: >> telnetTask
I (9851) wifi:<ba-del>idx:0, tid:0
W (9851) wifi:<ba-add>idx:0, ifx:0, tid:0, TAHI:0x100864d, TALO:0x720e6ed6, (ssn:3, win:64, cur_ssn:3), CONF:0xc0000005

assert failed: 0x42200e38
0x42200e38: xQueueGenericSend at C:/Users/kelka/esp/v5.1.3/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c:872 (discriminator 1)

Core  0 register dump:
MEPC    : 0x408005f6  RA      : 0x4080e4f2  SP      : 0x4082b2d0  GP      : 0x40813a70
0x408005f6: panic_abort at C:/Users/kelka/esp/v5.1.3/esp-idf/components/esp_system/panic.c:472
0x4080e4f2: __ubsan_include at C:/Users/kelka/esp/v5.1.3/esp-idf/components/esp_system/ubsan.c:313

TP      : 0x407b5a08  T0      : 0x37363534  T1      : 0x7271706f  T2      : 0x33323130
S0/FP   : 0x42200e3c  S1      : 0x40820bcc  A0      : 0x4082b2e4  A1      : 0x00000030
0x42200e3c: xQueueGenericSend at C:/Users/kelka/esp/v5.1.3/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c:872 (discriminator 1)

A2      : 0x00000003  A3      : 0x4082b2f8  A4      : 0x00000001  A5      : 0x40825000
A6      : 0x00000000  A7      : 0x76757473  S2      : 0x00000000  S3      : 0x40820c20
S4      : 0x40820c00  S5      : 0x40820bfc  S6      : 0x00010000  S7      : 0x00001c00
S8      : 0x0000ffff  S9      : 0x000000c0  S10     : 0x0000fff5  S11     : 0x00000021
T3      : 0x6e6d6c6b  T4      : 0x6a696867  T5      : 0x66656463  T6      : 0x62613938
MSTATUS : 0x00001881  MTVEC   : 0x40800001  MCAUSE  : 0x00000007  MTVAL   : 0x00000000
0x40800001: _vector_table at ??:?

MHARTID : 0x00000000

Stack memory:
4082b2d0: 0x4080e77c 0x42200eb4 0x42200e3c 0x4081172e 0x407b5a08 0x65737361 0x66207472 0x656c6961
0x4080e77c: vPortClearInterruptMask at C:/Users/kelka/esp/v5.1.3/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c:384
0x42200eb4: xQueueGenericSend at C:/Users/kelka/esp/v5.1.3/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c:999
0x42200e3c: xQueueGenericSend at C:/Users/kelka/esp/v5.1.3/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c:872 (discriminator 1)
0x4081172e: newlib_include_assert_impl at C:/Users/kelka/esp/v5.1.3/esp-idf/components/newlib/assert.c:93

4082b2f0: 0x30203a64 0x32323478 0x33653030 0x00000038 0x00000000 0x00000000 0x40820bfc 0x42200e3c
0x42200e3c: xQueueGenericSend at C:/Users/kelka/esp/v5.1.3/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c:872 (discriminator 1)

4082b310: 0x00000008 0x0000000a 0x00000000 0x00000000 0x00000000 0x00000049 0x00000001 0x00000001
4082b330: 0x00010000 0x00000000 0x40820c00 0x40820c20 0x00000000 0x40820bcc 0x40820bfc 0x4217ec9c
0x4217ec9c: sys_sem_signal at C:/Users/kelka/esp/v5.1.3/esp-idf/components/lwip/port/freertos/sys_arch.c:136

4082b350: 0x00000002 0x00000000 0x40820bfc 0x4216ed3c 0x407b5a08 0x00000000 0x00000001 0x40820bfc
0x4216ed3c: dns_call_found at C:/Users/kelka/esp/v5.1.3/esp-idf/components/lwip/lwip/src/core/dns.c:1026

4082b370: 0x00000000 0x00000000 0x40820bfc 0x4216ee22 0x00000000 0x40857ec0 0x40820bfc 0x4216f662
0x4216ee22: dns_correct_response at C:/Users/kelka/esp/v5.1.3/esp-idf/components/lwip/lwip/src/core/dns.c:1224
0x4216f662: dns_recv at C:/Users/kelka/esp/v5.1.3/esp-idf/components/lwip/lwip/src/core/dns.c:1433

4082b390: 0x00000008 0x0000000a 0x4082b45c 0xffffffff 0x00000000 0x01000100 0x80812e8b 0x01000100
4082b3b0: 0x00000000 0x01000100 0x21000000 0x00000400 0xae86cb74 0x00000000 0x00000001 0x00000000
4082b3d0: 0x4082b45c 0x00000000 0x4082a9cc 0x00000000 0x00000000 0x00000000 0x00000000 0x00000001
4082b3f0: 0x00000000 0x00000014 0x40834a48 0x40834a48 0x40857ec0 0x40857ede 0x408210ac 0x42179e50
0x42179e50: ip4_input at C:/Users/kelka/esp/v5.1.3/esp-idf/components/lwip/lwip/src/core/ipv4/ip4.c:794

4082b410: 0x40825000 0xffffffff 0x4083d36c 0x00000000 0x00000004 0x00000003 0x00000000 0x00000002
4082b430: 0x00000008 0x40834a48 0x40857ec0 0x4217e6b4 0x40825000 0xffffffff 0x4083d36c 0x4216e5ac
0x4217e6b4: ethernet_input at C:/Users/kelka/esp/v5.1.3/esp-idf/components/lwip/lwip/src/netif/ethernet.c:253
0x4216e5ac: tcpip_thread_handle_msg at C:/Users/kelka/esp/v5.1.3/esp-idf/components/lwip/lwip/src/api/tcpip.c:174
 (inlined by) tcpip_thread at C:/Users/kelka/esp/v5.1.3/esp-idf/components/lwip/lwip/src/api/tcpip.c:148

4082b450: 0x00000000 0x00000000 0x00000000 0x4083d36c 0x00000000 0x00000000 0x00000000 0x00000000
4082b470: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
4082b490: 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0x00000160
4082b4b0: 0x4082b350 0x000003ae 0x40818504 0x40818504 0x4082b4b0 0x408184fc 0x00000007 0x4082a9f8
4082b4d0: 0x4082a9f8 0x4082b4b0 0x00000000 0x00000012 0x4082aaac 0x00546974 0x00020000 0x40809d54
0x40809d54: spi_flash_check_and_flush_cache at C:/Users/kelka/esp/v5.1.3/esp-idf/components/spi_flash/flash_mmap.c:368

4082b4f0: 0x00000d03 0x00000000 0x4082b4a0 0x0000000b 0x00000000 0x00000012 0x00000000 0x00000000
4082b510: 0x00000000 0x00003771 0x00000000 0x40828ec4 0x40828f2c 0x40828f94 0x00000000 0x00000000
4082b530: 0x00000001 0x00000000 0x00000000 0x00000000 0x421efb14 0x00000000 0x00000000 0x00000000
0x421efb14: _cleanup_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/newlib/newlib/libc/stdio/findfp.c:229

4082b550: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
4082b570: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
4082b590: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
4082b5b0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
4082b5d0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
4082b5f0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x40000000
0x40000000: _start in ROM

4082b610: 0x0000005c 0x4082b614 0x4082b614 0x4082b614 0x4082b614 0x00000000 0x4082b62c 0xffffffff
4082b630: 0x4082b62c 0x4082b62c 0x00000000 0x4082b640 0xffffffff 0x4082b640 0x4082b640 0x00000001
4082b650: 0x00000001 0x00000000 0x0000ffff 0x00000000 0x4082f038 0x40880003 0xb33fffff 0x00000000
4082b670: 0x00000018 0x42269dd4 0x4082b690 0x408348e4 0x00000000 0x4082b8f0 0x40834b48 0x0000025c
4082b690: 0x4082b6ec 0x4082b73c 0x4082b8ec 0x4082b72c 0x00000000 0x4082b6a8 0xffffffff 0x4082b6a8
4082b6b0: 0x4082b6a8 0x00000001 0x4082b6bc 0xffffffff 0x408348fc 0x408348fc 0x00000000 0x00000020



ELF file SHA256: 9d21eeba42991caf

Rebooting in  3 seconds...
Rebooting...

ANOTHER log

I (8691) wifi.c:0355 : Connected to Direct
I (8741) wifi:[ADDBA]RX addba response, status:0, tid:0/tb:1(0xa1), bufsize:64, batimeout:0, txa_wnd:64
I (8741) wifi:[ADDBA]RX addba response, status:0, tid:7/tb:1(0xa1), bufsize:64, batimeout:0, txa_wnd:64
I (8741) wifi:[ADDBA]RX addba response, status:0, tid:5/tb:1(0xa1), bufsize:64, batimeout:0, txa_wnd:64
W (8761) wifi:<ba-add>idx:0, ifx:0, tid:6, TAHI:0x100864d, TALO:0x720e6ed6, (ssn:0, win:64, cur_ssn:0), CONF:0xc0006005
I (9141) functions.c:0674 : current settings time 1/1/0 0:0:0
I (9141) functions.c:0678 : current timetable time 1/1/0 0:0:0
I (9691) esp_netif_handlers: sta ip: 192.168.3.98, mask: 255.255.255.0, gw: 192.168.3.1
I (9691) wifi.c:1079 : STOP STA CONNECT TIMER
I (9691) wifi.c:1085 : STOP STA CONNECT TIMER: DONE
I (9701) wifi.c:0397 : IP_EVENT: IP_EVENT_STA_GOT_IP
I (9701) wifi.c:0409 : IP_EVENT: got ip: 192.168.3.98
I (9711) flash.c:0811 : Set nvs wifiResetCount done: 0
I (9721) flash.c:0831 : Set nvs backup wifiResetCount done: 0
I (9721) wifi.c:1004 : START MULTICAST TIMER
I (9731) flash.c:0758 : Get from nvs telnetLogOn done: 1
I (9741) telnet_log.c:0075 : INFO: telnetTask
I (9741) wifi.c:0491 : ##### Inited debugInfoTimer not requested
I (9751) esp-cloud.c:0273 : Seeding the random number generator
I (9761) esp-cloud.c:0282 : Setting up the SSL/TLS structure...
I (9771) esp-cloud.c:0872 : START RECEIVE TIMER: 9000 ms
I (9771) esp-cloud.c:0876 : START RECEIVE TIMER: STARTED
I (9781) esp-cloud.c:0346 : Connecting to p1:9030... freeHeap 149588
uru Meditation Error: Core  0 panic'ed (Load access fault). Exception was unhandled.

Core  0 register dump:
MEPC    : 0x4200727c  RA      : 0x4200721e  SP      : 0x408502f0  GP      : 0x40813a70  
0x4200727c: uart_end_select at C:/Users/kelka/esp/v5.1.3/esp-idf/components/vfs/vfs_uart.c:516
0x4200721e: unregister_select at C:/Users/kelka/esp/v5.1.3/esp-idf/components/vfs/vfs_uart.c:390
 (inlined by) uart_end_select at C:/Users/kelka/esp/v5.1.3/esp-idf/components/vfs/vfs_uart.c:514

TP      : 0x407dab10  T0      : 0x40022494  T1      : 0x4080e96e  T2      : 0x00000000
0x40022494: multi_heap_internal_unlock in ROM
0x4080e96e: xQueueGenericSendFromISR at C:/Users/kelka/esp/v5.1.3/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c:1117

S0/FP   : 0x00000000  S1      : 0x00000000  A0      : 0x00000001  A1      : 0x40856ca0
A2      : 0x40856d30  A3      : 0x00000004  A4      : 0x00000001  A5      : 0x40825000
A6      : 0x00000000  A7      : 0x4216b5f4  S2      : 0x40856ca0  S3      : 0x40856d30
0x4216b5f4: event_start_select at C:/Users/kelka/esp/v5.1.3/esp-idf/components/vfs/vfs_eventfd.c:99

S4      : 0x0000001c  S5      : 0x408503a8  S6      : 0x00000001  S7      : 0x40856d10
S8      : 0x00000000  S9      : 0x00000000  S10     : 0x40813608  S11     : 0x00000005
T3      : 0x00000000  T4      : 0x00000000  T5      : 0x00000000  T6      : 0x00000000
MSTATUS : 0x00001881  MTVEC   : 0x40800001  MCAUSE  : 0x00000005  MTVAL   : 0x00000014
0x40800001: _vector_table at ??:?

MHARTID : 0x00000000

Stack memory:
408502f0: 0x00000001 0x408503a8 0x408503a0 0x40856d30 0x40856ca0 0x00000005 0x00000000 0x42005f7a
0x42005f7a: call_end_selects at C:/Users/kelka/esp/v5.1.3/esp-idf/components/vfs/vfs.c:824 (discriminator 15)

40850310: 0x00000001 0x408503a8 0x408503a0 0x408503b0 0x00000001 0x40829268 0x40856d30 0x4200695a
0x4200695a: esp_vfs_select at C:/Users/kelka/esp/v5.1.3/esp-idf/components/vfs/vfs.c:1072

40850330: 0x40856ca0 0x00000005 0x00000005 0x40813608 0x40856d14 0x408505ac 0x00000000 0x40813614
40850350: 0x420d3664 0x420d1b1a 0x00000001 0x40829268 0x00000000 0x408503a0 0x40829248 0x00000000
0x420d3664: zb_mac_allows_transport_iteration at ??:?
0x420d1b1a: zb_mm_mac_allows_transport_iteration_proxy at ??:?

40850370: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x0000004d 0x000a2bf0 0x00000000
40850390: 0x00000000 0x40825000 0x00000000 0x4215bbc2 0x00000000 0x00000000 0x00000000 0x00000000
0x4215bbc2: zb_osif_iteration_process at zb_esp_osif.c.obj:?

408503b0: 0x00000000 0x00000000 0x00000004 0x4215bcf0 0x00000000 0x00000000 0x00000000 0x4215bd3c
0x4215bcf0: zb_osif_disable_all_interrupts at ??:?
0x4215bd3c: zb_osif_iteration at ??:?

408503d0: 0x00000000 0x00000000 0x00957b7e 0x420d1b58 0x00000000 0x00000000 0x00957b7e 0x420d2098
0x420d1b58: zb_sched_mac_transport_iteration at zb_scheduler.c.obj:?
0x420d2098: zb_sched_loop_iteration at ??:?

408503f0: 0x408292ac 0x00000000 0x408562c4 0x42201330 0x00000000 0x4216b5f4 0x00000000 0xffffffff
0x42201330: xQueueTakeMutexRecursive at C:/Users/kelka/esp/v5.1.3/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c:788
0x4216b5f4: event_start_select at C:/Users/kelka/esp/v5.1.3/esp-idf/components/vfs/vfs_eventfd.c:99

40850410: 0x408292ac 0x00000000 0x00000000 0x00000000 0x408292ac 0x40829268 0x40829294 0x42117aba
0x42117aba: zboss_main_loop_iteration at ??:?

40850430: 0x00000000 0x00000000 0x00000000 0x420b0b30 0x00000000 0x00000000 0x40856784 0x420b0b3e
0x420b0b30: esp_zb_stack_main_loop_iteration at ??:?
0x420b0b3e: esp_zb_stack_main_loop at ??:?

40850450: 0x408292ac 0x40829268 0x40829294 0x4203a972 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0x01010401
0x4203a972: esp_zb_task at X:/Dev/DS_Projects/dsexs-3-cc-3-vasiltsov/trunk/trunk_esp32c3/main/zigbee/zigbee.c:457 (discriminator 2)

40850470: 0xa5a5a003 0x00000008 0x0a28ffff 0x010407d0 0x00000000 0x00000000 0x0000000a 0x00000000
40850490: 0x00000200 0x00000000 0x00000001 0x00000001 0x00000000 0x00000002 0x00000000 0x00000000
408504b0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
408504d0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
408504f0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
40850510: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5
40850530: 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0xa5a5a5a5 0x00000160 0x40850260 0x00000375 0x40857714
40850550: 0x4081848c 0x40850544 0x40818484 0x0000000d 0x40829294 0x40829294 0x40850544 0x00000000
40850570: 0x0000000c 0x4084f140 0x6267695a 0x6d5f6565 0x006e6961 0x0023ae0e 0x00000000 0x40850530
40850590: 0x00000013 0x00000000 0x0000000c 0x00000000 0x00000000 0x00000000 0x0003efcf 0x00000000
408505b0: 0x40828ec4 0x40828f2c 0x40828f94 0x00000000 0x00000000 0x00000001 0x00000000 0x00000000
408505d0: 0x00000000 0x421ef9ea 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
0x421ef9ea: _cleanup_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/riscv32-esp-elf/src/newlib/newlib/libc/stdio/findfp.c:229

408505f0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
40850610: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
40850630: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
40850650: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
40850670: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
40850690: 0x00000000 0x00000000 0x00000000 0x00000000 0x40000000 0x000000f8 0x00000000 0x00000000
0x40000000: _start in ROM

408506b0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000
408506d0: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000



ELF file SHA256: 361610090f54650b

Additional context.

No response

@github-actions github-actions bot changed the title Wifi + SSL + Zigbee Crash Wifi + SSL + Zigbee Crash (TZ-1130) Sep 12, 2024
@OOHehir
Copy link

OOHehir commented Sep 14, 2024

My understanding is that Zigbee & WiFi on current devices, simultaneously, is not supported. I investigated briefly on a ESP32C6& didn't have good results. This is probably your best solution.

@lpy4105
Copy link
Contributor

lpy4105 commented Sep 20, 2024

Hi @kioelka

It seems that the crash log is not related to co-existence. Could you please share more details? E.g. the steps to reproduce the issue, app code snippet?

BTW, did the WiFi part itself could work correctly (without Zigbee functional enabled)?

@kioelka
Copy link
Author

kioelka commented Sep 20, 2024

Hi @kioelka

It seems that the crash log is not related to co-existence. Could you please share more details? E.g. the steps to reproduce the issue, app code snippet?

BTW, did the WiFi part itself could work correctly (without Zigbee functional enabled)?
on second question answer - "yes" wifi works well without zigbee. also, wifi + zigbee works together fine if zigbee start after ssl handshake done, but, if internet fall down for a time, when wifi reconnects to AP and SSL session restarts, app crashes cause zigbee is active this time.

/**
 * Init ssl connection
 */
void sslClientTask(void *pvParameters)
{

    if ((devc.isUpdating) && (devc.currentCumulativeOTAStatus.source != ZNOCloudUpdate))
    {
        vTaskDelete(NULL);
    }

    DEBUG_MSG(BDL, (COL_CLOUD "certsOk: %d", devc.certsOk));

    static int tls_error_count;
    static int reconnect_tries;
    static int success_connects;

    char buf[CLOUD_READBUF];
    int ret, flags, err;
    vTaskDelay(pdMS_TO_TICKS(50));
    DEBUG_MSG(BDL, (COL_CLOUD "mbedTLS thread start OK"));

    devc.cloudPin = initState;

    wifiInit((wifi_mode_t)WIFI_MODE_STA); 

#if defined(CONFIG_IDF_TARGET_ESP32C6)
    DEBUG_MSG(BDL, (COL_EXCHANGE "initZigbee()" ));
    xTaskCreate(esp_zb_task, "Zigbee_main", ZIBGEE_TASK_STACK, NULL, ZIGBEE_TASK_PRIORITY, &devc.zbTaskHandle);
#endif

    time(&now);
    localtime_r(&now, &timeinfo);

    if (!devc.certsOk)
    {
        DEBUG_MSG(BDL, (COL_ERROR COL_CLOUD "Certs corrupted, delete task"));
        vTaskDelete(NULL);
    }

    mbedtls_entropy_context entropy;
    mbedtls_ctr_drbg_context ctr_drbg;
    // mbedtls_ssl_context ssl;
    mbedtls_x509_crt cacert;
    mbedtls_x509_crt clicert;
    mbedtls_pk_context pkey;
    mbedtls_ssl_config conf;
    mbedtls_net_context server_fd;

    devc.cloudCon.sslc = &ssl;

    xEventGroupSetBits(devc.cloudEventGroup, CLOUD_FAIL_BIT);
    xEventGroupWaitBits(devc.wifiEventGroup, WIFI_CONNECTED_BIT,
                        false, true, portMAX_DELAY);
    mbedtls_ssl_init(&ssl);
    mbedtls_ctr_drbg_init(&ctr_drbg);

    mbedtls_ssl_config_init(&conf);
    ...
   
   ...
        if (!waitTimes)
        { // try to connect ot cloud by ip
            waitTimes = CONNECT_WAIT_TIMES;
            while (waitTimes)
            {
                DEBUG_MSG(BDL, (COL_CLOUD "Connecting to %s:%s...", devc.cloudIp, devc.cloudPort)); // TLS_PORT));
                if ((ret = mbedtls_net_connect(&server_fd, devc.cloudIp,
                                               devc.cloudPort, MBEDTLS_NET_PROTO_TCP)) != 0)
                {
                    DEBUG_MSG(IDL, (COL_ERROR COL_CLOUD "mbedtls_net_connect returned -%x", -ret));
                    waitTimes--;
                }
                else
                {
                    break;
                }
                vTaskDelay(pdMS_TO_TICKS(5 * 1000)); // 15 sec here
            }
            if (!waitTimes)
                goto exit;
        }

        devc.connectionState = serverConnection;
        DEBUG_MSG(BDL, (COL_CLOUD "Connected"));

        getExtIP();
void getExtIP()
{

#define SERVER_NAME "api.ipify.org"
#define SERVER_PORT "80"
#define PATH "/?format=json"
    const char *getRequest = "GET " PATH " HTTP/1.1\r\nHost: " SERVER_NAME "\r\nAccept: */*\r\n\r\n";
    devc.extIPaddress = 0;
    if (getOtaStage())
        return;
    int sock = openSocket(SERVER_NAME ":" SERVER_PORT);
    char response[256];
    if (sock != ESP_FAIL)
    {
        send(sock, getRequest, strlen(getRequest), 0);
        // Get answer
        recv(sock, response, 256, 0);
        char *ipStr = strstr(response, "\"ip\":\"") + 6;
        if (ipStr != NULL)
        {
            *(strrchr(ipStr, '\"')) = 0;
            devc.extIPaddress = inet_addr(ipStr);
            DEBUG_MSG(CDL, (COL_WIFI "Ip address %s [%d]", ipStr, devc.extIPaddress));
        }
    }
    close(sock);
}

usually it falls in getExtIP() function

I (72564) wifi.c:2028 : ip addr: 104.26.13.205
I (72739) wifi.c:2044 : 104.26.13.205: connected; socket: 58
I (72742) wifi.c:2062 : Port 80 opened
I (72767) wifi.c:1957 : socket #58 opened, delete task

or sslClientTask in connectibg to cloud

I (9791) esp-cloud.c:0346 : Connecting to p1:9030... freeHeap 149636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants