完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
就是我在使用esp_http_client_init()函数时,运行时会报错,板子不断reboot,这是什么原因导致的,有什么解决的办法吗?
以下是我调用esp_http_client_init()的相关函数 esp_http_client_config_t config; config.event_handler = ocr_http_event_handler; config.buffer_size = 4 * 1024; config.timeout_ms = 4000; config.url = temp_url.c_str(); Serial.print("config.url = "); Serial.println(config.url); esp_http_client_handle_t client = esp_http_client_init(&config); esp_http_client_set_method(client, HTTP_METHOD_POST); esp_http_client_set_header(client, "Content-Type", "application/x-www-form-urlencoded"); esp_http_client_set_post_field(client, temp_url.c_str(), sizeof(temp_url.c_str())); 以下是报错的内容 Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled. Core 1 register dump: PC : 0x4008d858 PS : 0x00060730 A0 : 0x800d7a48 A1 : 0x3ffb1e00 A2 : 0x0000000f A3 : 0x0000000b A4 : 0x000000ff A5 : 0x0000ff00 A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000001 A9 : 0x00000000 A10 : 0x3ffdf50c A11 : 0x3f401614 A12 : 0x000000ff A13 : 0x0000ff00 A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000019 EXCCAUSE: 0x0000001c EXCVADDR: 0x0000000f LBEG : 0x4008d879 LEND : 0x4008d889 LCOUNT : 0xfffffffd ELF file SHA256: 0000000000000000 Backtrace: 0x4008d858:0x3ffb1e00 0x400d7a45:0x3ffb1e10 0x400d161b:0x3ffb1e30 0x400d1bb9:0x3ffb1ec0 0x400d537c:0x3ffb1fb0 0x400908de:0x3ffb1fd0 以下是错误的出处 C:Users28032AppDataLocalArduino15packagesesp32toolsxtensa-esp32-elf-gcc1.22.0-97-gc752ad5-5.2.0bin>xtensa-esp32-elf-addr2line -e python.ino.elf 0x4008d858:0x3ffb1e00 0x400d7a45:0x3ffb1e10 0x400d161b:0x3ffb1e30 0x400d1bb9:0x3ffb1ec0 0x400d537c:0x3ffb1fb0 0x400908de:0x3ffb1fd0 /home/mak/e/p/newlib_old/newlib_xtensa-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xtensa/../../../../.././newlib/libc/machine/xtensa/strlen.S:46 /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_http_client/esp_http_client.c:335 C:Users28032DocumentsArduinopython/python.ino:163 C:Users28032DocumentsArduinopython/python.ino:283 C:Users28032AppDataLocalArduino15packagesesp32hardwareesp321.0.6coresesp32/main.cpp:30 /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1) |
|
相关推荐
1个回答
|
|
|
以下是一些建议和可能的原因:
1. **检查错误处理**:在使用 `esp_http_client_init()` 函数时,您需要检查返回值。如果返回值为 `NULL`,则表示初始化失败。您可以添加以下代码来检查错误: ```cpp esp_http_client_handle_t client = esp_http_client_init(&config); if (client == NULL) { Serial.println("Error: HTTP client initialization failed"); return; } ``` 2. **检查 URL**:确保 `temp_url` 是一个有效的 URL。如果 URL 格式不正确或为空,可能会导致错误。 3. **检查网络连接**:确保您的 ESP32 板子已经连接到网络。如果网络连接不稳定或无法连接,可能会导致 HTTP 请求失败。 4. **检查内存问题**:ESP32 的内存有限,如果内存不足,可能会导致程序崩溃和重启。您可以使用 `esp_get_free_heap_size()` 函数来检查剩余的内存。 5. **检查其他资源问题**:确保您的 ESP32 板子没有其他正在运行的任务或资源冲突,这可能会影响 HTTP 请求的执行。 6. **检查错误日志**:如果您的 ESP32 板子支持打印错误日志,您可以查看日志以获取更多关于错误的信息。 7. **更新 ESP-IDF**:确保您使用的 ESP-IDF 版本是最新的,以避免可能的已知问题。 8. **检查事件处理函数**:您提到使用了 `ocr_http_event_handler` 作为事件处理函数。请确保该函数正确实现了,并且没有导致任何错误。 |
|
|
|
|
只有小组成员才能发言,加入小组>>
470 浏览 0 评论
991 浏览 0 评论
1709 浏览 0 评论
请问一下我想用ESP8685直接替换ESP8266而不用写程序,可以让ESP8685直接通过之前ESP8266的外挂的flash运行程序吗
1368 浏览 1 评论
1254 浏览 1 评论
为blufi_device设置自定义名称,但是无法修改,为什么?
1287浏览 4评论
请问ESP32-S2-WROOM怎么获得ESP32-S2外接FLASH的唯一序列号?
943浏览 3评论
2384浏览 3评论
ESP-IDF的VScode插件的build按钮点击会报错的原因?
2570浏览 3评论
ESP-Jumpstart例程中第5个工程:5_cloud连接报错是哪里的问题?
1071浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-13 08:45 , Processed in 0.678037 second(s), Total 77, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
389
