完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
麻烦请教一个问题,我现在用的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:Code: [Select all] [Expand/Collapse] bcn_timout,ap_probe_send_start GeSHi © Codebox Plus Extension 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:idx W (204852) wifi:idx I (204852) wifi[img=28,30][/img]<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[img=28,30][/img]<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一次,这样重启的太频繁了,请问有什么建议可以改善重启? |
|
相关推荐
1个回答
|
|
从您的描述来看,您的ESP32-WROOM模块在使用ESP-IDF时遇到了bcn_timeout问题,导致设备重启。这个问题可能是由于蓝牙和Wi-Fi之间的冲突导致的。以下是一些建议来解决这个问题:
1. **降低Wi-Fi扫描频率**:在您的代码中,尝试降低Wi-Fi扫描的频率,以减少与蓝牙的冲突。您可以通过修改Wi-Fi配置来实现这一点。 2. **使用不同的通道**:尝试将Wi-Fi和蓝牙设置为使用不同的通道,以减少它们之间的干扰。 3. **优化代码结构**:在您的代码中,尝试优化HTTP请求的发送和接收过程。例如,您可以使用非阻塞的方式来发送和接收数据,以减少对系统资源的占用。 4. **检查电源管理**:确保您的ESP32-WROOM模块的电源管理设置正确,以避免因电源问题导致的重启。 5. **更新ESP-IDF版本**:尽管您使用的是最新版本的ESP-IDF,但有时新版本可能存在一些已知的问题。您可以尝试使用之前的稳定版本,看看问题是否仍然存在。 6. **查看错误日志**:检查ESP32的错误日志,以获取更多关于bcn_timeout问题的信息。这将有助于您更好地了解问题的原因,并找到解决方案。 |
|
|
|
只有小组成员才能发言,加入小组>>
532浏览 6评论
449浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
431浏览 5评论
427浏览 4评论
404浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-11 02:11 , Processed in 0.547556 second(s), Total 47, Slave 41 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号