bcn_timout造成重启
Posted: Wed Mar 31, 2021 12:22 pm
麻烦请教一个问题,我现在用的esp-idf是最新的版本,用的模块是ESP32-WROOM,我的应用同时支持蓝牙和OTA升级,主要的任务是通过http的post请求一个服务器然后取回数据,现在的工作模式是发送post请求,然后得到请求回复,解析数据以后一秒钟发送下一次请求。我的程序结构和peform stream read 类似:大概是如下一个结构:
while(1)
{
esp_http_client_init()
esp_http_client_open();
esp_http_client_write();
esp_http_client_fetch_headers()
esp_http_client_read()
解析数据
esp_http_client_close();
esp_http_client_cleanup();
}
这样反复循环,开始能够正常收到数据循环,大概120次左右esp32就会重启,出现的log输出:
D (185942) HTTP_CLIENT: Begin connect to: http://192.168.1.110:80
D (185942) esp-tls: host:192.168.1.110: strlen 13
D (185942) esp-tls: [sock=54] Resolved IPv4 address: 192.168.1.110
D (185952) esp-tls: [sock=54] Connecting to server. HOST: 192.168.1.110, Port: 80
D (185992) esp-tls: non-tls connection established
D (185992) HTTP_CLIENT: Write header[4]: POST /mqtt/handlers/httpserver.ashx HTTP/1.1
User-Agent: ESP32 HTTP Client/1.0
Host: 192.168.1.110
Content-Type: application/json
Content-Length: 78
D (194362) HTTP_CLIENT: Begin connect to: http://192.168.1.110:80
D (194362) esp-tls: host:192.168.1.110: strlen 13
D (194372) esp-tls: [sock=54] Resolved IPv4 address: 192.168.1.110
D (194372) esp-tls: [sock=54] Connecting to server. HOST: 192.168.1.110, Port: 80
D (194692) esp-tls: non-tls connection established
D (194702) HTTP_CLIENT: Write header[4]: POST /mqtt/handlers/httpserver.ashx HTTP/1.1
User-Agent: ESP32 HTTP Client/1.0
Host: 192.168.1.110
Content-Type: application/json
Content-Length: 78
I (202332) wifi:
D (202362) HTTP_CLIENT: Begin connect to: http://192.168.1.110:80
D (202362) esp-tls: host:192.168.1.110: strlen 13
D (202362) esp-tls: [sock=54] Resolved IPv4 address: 192.168.1.110
D (202372) esp-tls: [sock=54] Connecting to server. HOST: 192.168.1.110, Port: 80
D (202722) esp-tls: non-tls connection established
D (202722) HTTP_CLIENT: Write header[4]: POST /mqtt/handlers/httpserver.ashx HTTP/1.1
User-Agent: ESP32 HTTP Client/1.0
Host: 192.168.1.110
Content-Type: application/json
Content-Length: 78
I (204842) wifi:ap_probe_send over, resett wifi status to disassoc
I (204842) wifi:state: run -> init (c800)
I (204842) wifi:pm stop, total sleep time: 145908275 us / 200493962 us
W (204842) wifi:<ba-del>idx
W (204852) wifi:<ba-del>idx
I (204852) wifi<6,0>, old:<6,2>, ap:<255,255>, sta:<6,2>, prof:1
D (204862) event: running post WIFI_EVENT:5 with handler 0x4014907c and context 0x3ffdf2c0 on loop 0x3ffcdaf0
0x4014907c: wifi_default_action_sta_disconnected at xxxxx/esp-idf/components/esp_wifi/src/wifi_default.c:107
D (204862) esp_netif_handlers: esp_netif action disconnected with netif0x3ffdf044 from event_id=5
D (204872) esp_netif_lwip: check: remote, if=0x3ffdf044 fn=0x4013e354
0x4013e354: esp_netif_down_api at xxxx/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:1226
D (204882) esp_netif_lwip: esp_netif_down_api esp_netif:0x3ffdf044
E (204892) TRANSPORT_BASE: esp_tls_conn_write error, errno=Software caused connection abort
D (204892) esp_netif_lwip: esp_netif_dhcpc_cb lwip-netif:0x3ffdf0a4
E (204902) HTTP_CLIENT: Error write request
D (204902) esp_netif_lwip: esp_netif_start_ip_lost_timer esp_netif:0x3ffdf044
D (204912) esp_netif_lwip: if0x3ffdf044 start ip lost tmr: interval=120
D (204922) esp_netif_lwip: esp_netif_start_ip_lost_timer esp_netif:0x3ffdf044
D (204932) esp_netif_lwip: if0x3ffdf044 start ip lost tmr: already started
D (204932) esp_netif_lwip: check: local, if=0x3ffdf044 fn=0x4013eb38
0x4013eb38: esp_netif_update_default_netif_lwip at xxxxxx/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:174
D (204942) esp_netif_lwip: esp_netif_update_default_netif_lwip 0x3ffdf044
D (204952) esp_netif_lwip: call api in lwip: ret=0x0, give sem
D (204952) event: running post WIFI_EVENT:5 with handler 0x400de130 and context 0x3ffdf384 on loop 0x3ffcdaf0
0x400de130: on_wifi_disconnect at /home/niexuzhong/esp-idf/examples/ota/build/../main/wifi.c:245
I (204962) WiFi Station: Wi-Fi disconnected, trying to reconnect...
I (204972) HTTP_CLIENT: open socket error
I (204982) wifi<6,2>, old:<6,0>, ap:<255,255>, sta:<6,2>, prof:1
I (204982) wifi:state: init -> auth (b0)
D (204982) HTTP_CLIENT: Begin connect to: http://192.168.1.110:80
D (204992) esp-tls: host:192.168.1.110: strlen 13
D (205002) esp-tls: [sock=54] Resolved IPv4 address: 192.168.1.110
D (205002) esp-tls: [sock=54] Connecting to server. HOST: 192.168.1.110, Port: 80
E (205012) esp-tls: [sock=54] connect() error: Host is unreachable
E (205022) esp-tls: Failed to open new connection
E (205022) TRANSPORT_BASE: Failed to open a new connection
E (205032) HTTP_CLIENT: Connection failed, sock < 0
I (205032) HTTP_CLIENT: open socket error
D (205042) HTTP_CLIENT: Begin connect to: http://192.168.1.110:80
E (205042) esp-tls: empty esp_tls parameter
E (205052) esp-tls: Failed to open new connection
E (205062) TRANSPORT_BASE: Failed to open a new connection
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x401af1d7 PS : 0x00060930 A0 : 0x801af218 A1 : 0x3ffbc2d0
我在网上搜索一下,发现可能是内存不够了,造成这个bcn_timout,ap_probe_send_start错误,现在的问题是我一秒钟post一次,这样重启的太频繁了,请问有什么建议可以改善重启?
while(1)
{
esp_http_client_init()
esp_http_client_open();
esp_http_client_write();
esp_http_client_fetch_headers()
esp_http_client_read()
解析数据
esp_http_client_close();
esp_http_client_cleanup();
}
这样反复循环,开始能够正常收到数据循环,大概120次左右esp32就会重启,出现的log输出:
D (185942) HTTP_CLIENT: Begin connect to: http://192.168.1.110:80
D (185942) esp-tls: host:192.168.1.110: strlen 13
D (185942) esp-tls: [sock=54] Resolved IPv4 address: 192.168.1.110
D (185952) esp-tls: [sock=54] Connecting to server. HOST: 192.168.1.110, Port: 80
D (185992) esp-tls: non-tls connection established
D (185992) HTTP_CLIENT: Write header[4]: POST /mqtt/handlers/httpserver.ashx HTTP/1.1
User-Agent: ESP32 HTTP Client/1.0
Host: 192.168.1.110
Content-Type: application/json
Content-Length: 78
D (194362) HTTP_CLIENT: Begin connect to: http://192.168.1.110:80
D (194362) esp-tls: host:192.168.1.110: strlen 13
D (194372) esp-tls: [sock=54] Resolved IPv4 address: 192.168.1.110
D (194372) esp-tls: [sock=54] Connecting to server. HOST: 192.168.1.110, Port: 80
D (194692) esp-tls: non-tls connection established
D (194702) HTTP_CLIENT: Write header[4]: POST /mqtt/handlers/httpserver.ashx HTTP/1.1
User-Agent: ESP32 HTTP Client/1.0
Host: 192.168.1.110
Content-Type: application/json
Content-Length: 78
I (202332) wifi:
- bcn_timout,ap_probe_send_start
D (202362) esp-tls: host:192.168.1.110: strlen 13
D (202362) esp-tls: [sock=54] Resolved IPv4 address: 192.168.1.110
D (202372) esp-tls: [sock=54] Connecting to server. HOST: 192.168.1.110, Port: 80
D (202722) esp-tls: non-tls connection established
D (202722) HTTP_CLIENT: Write header[4]: POST /mqtt/handlers/httpserver.ashx HTTP/1.1
User-Agent: ESP32 HTTP Client/1.0
Host: 192.168.1.110
Content-Type: application/json
Content-Length: 78
I (204842) wifi:ap_probe_send over, resett wifi status to disassoc
I (204842) wifi:state: run -> init (c800)
I (204842) wifi:pm stop, total sleep time: 145908275 us / 200493962 us
W (204842) wifi:<ba-del>idx
W (204852) wifi:<ba-del>idx
I (204852) wifi<6,0>, old:<6,2>, ap:<255,255>, sta:<6,2>, prof:1
D (204862) event: running post WIFI_EVENT:5 with handler 0x4014907c and context 0x3ffdf2c0 on loop 0x3ffcdaf0
0x4014907c: wifi_default_action_sta_disconnected at xxxxx/esp-idf/components/esp_wifi/src/wifi_default.c:107
D (204862) esp_netif_handlers: esp_netif action disconnected with netif0x3ffdf044 from event_id=5
D (204872) esp_netif_lwip: check: remote, if=0x3ffdf044 fn=0x4013e354
0x4013e354: esp_netif_down_api at xxxx/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:1226
D (204882) esp_netif_lwip: esp_netif_down_api esp_netif:0x3ffdf044
E (204892) TRANSPORT_BASE: esp_tls_conn_write error, errno=Software caused connection abort
D (204892) esp_netif_lwip: esp_netif_dhcpc_cb lwip-netif:0x3ffdf0a4
E (204902) HTTP_CLIENT: Error write request
D (204902) esp_netif_lwip: esp_netif_start_ip_lost_timer esp_netif:0x3ffdf044
D (204912) esp_netif_lwip: if0x3ffdf044 start ip lost tmr: interval=120
D (204922) esp_netif_lwip: esp_netif_start_ip_lost_timer esp_netif:0x3ffdf044
D (204932) esp_netif_lwip: if0x3ffdf044 start ip lost tmr: already started
D (204932) esp_netif_lwip: check: local, if=0x3ffdf044 fn=0x4013eb38
0x4013eb38: esp_netif_update_default_netif_lwip at xxxxxx/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:174
D (204942) esp_netif_lwip: esp_netif_update_default_netif_lwip 0x3ffdf044
D (204952) esp_netif_lwip: call api in lwip: ret=0x0, give sem
D (204952) event: running post WIFI_EVENT:5 with handler 0x400de130 and context 0x3ffdf384 on loop 0x3ffcdaf0
0x400de130: on_wifi_disconnect at /home/niexuzhong/esp-idf/examples/ota/build/../main/wifi.c:245
I (204962) WiFi Station: Wi-Fi disconnected, trying to reconnect...
I (204972) HTTP_CLIENT: open socket error
I (204982) wifi<6,2>, old:<6,0>, ap:<255,255>, sta:<6,2>, prof:1
I (204982) wifi:state: init -> auth (b0)
D (204982) HTTP_CLIENT: Begin connect to: http://192.168.1.110:80
D (204992) esp-tls: host:192.168.1.110: strlen 13
D (205002) esp-tls: [sock=54] Resolved IPv4 address: 192.168.1.110
D (205002) esp-tls: [sock=54] Connecting to server. HOST: 192.168.1.110, Port: 80
E (205012) esp-tls: [sock=54] connect() error: Host is unreachable
E (205022) esp-tls: Failed to open new connection
E (205022) TRANSPORT_BASE: Failed to open a new connection
E (205032) HTTP_CLIENT: Connection failed, sock < 0
I (205032) HTTP_CLIENT: open socket error
D (205042) HTTP_CLIENT: Begin connect to: http://192.168.1.110:80
E (205042) esp-tls: empty esp_tls parameter
E (205052) esp-tls: Failed to open new connection
E (205062) TRANSPORT_BASE: Failed to open a new connection
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x401af1d7 PS : 0x00060930 A0 : 0x801af218 A1 : 0x3ffbc2d0
我在网上搜索一下,发现可能是内存不够了,造成这个bcn_timout,ap_probe_send_start错误,现在的问题是我一秒钟post一次,这样重启的太频繁了,请问有什么建议可以改善重启?