用串口接收数据然后调用espnow透传,espnow用广播方式发送,发现从调用esp_now_send之后到系统调用注册的espnow_send_cb之间总是有一个随机的延时存在,从10ms-50ms不等。整个例程代码一共只有串口接收和espnow接收两个任务,从串口接收到的数据立即会立即发送,发送器log如下:
�[0;31mE (1956376) uart_port: dt = 244�[0m
�[0;31mE (1956379) my_espnow2: dt = 236�[0m
�[0;31mE (1956620) uart_port: dt = 244�[0m
�[0;31mE (1956628) my_espnow2: dt = 248�[0m
�[0;31mE (1956864) uart_port: dt = 244�[0m
�[0;31mE (1956866) my_espnow2: dt = 238�[0m
�[0;31mE (1957108) uart_port: dt = 244�[0m
�[0;31mE (1957114) my_espnow2: dt = 248�[0m
�[0;31mE (1957352) uart_port: dt = 244�[0m
�[0;31mE (1957359) my_espnow2: dt = 245�[0m
�[0;31mE (1957596) uart_port: dt = 244�[0m
�[0;31mE (1957653) my_espnow2: dt = 294�[0m
�[0;31mE (1957840) uart_port: dt = 244�[0m
�[0;31mE (1957842) my_espnow2: dt = 189�[0m
�[0;31mE (1958084) uart_port: dt = 244�[0m
串口发送间隔是244ms。这个发送间隔计算写于串口接收之后、esp_now_send之前;espnow的发送完成间隔计算写于espnow_send_cb中,接收器的espnow接收任务中也计算了接收间隔,与发送端是匹配的。理想情况下,发送间隔是244ms,那么发送完成间隔也应该是244ms,接收间隔也应该是244ms,到底什么事件会产生这样一个延时?望指点。
我的开发板是esp32-c3,使用的idf版本是5.1.3,后来我又尝试用show example里的espnow例程来看发送是否存在延时,在espnow_send_cb计算了一下发送完成间隔。结论也是一样,发送间隔固定,但发送完成间隔不固定,最严重的时候有个30ms延迟。
随后我又在调用esp_now_send之后和系统调用espnow_send_cb之间计算了时间差,log如下:
�[0;31mE (437617) my_espnow2: dt = 7�[0m
�[0;31mE (437787) my_espnow2: dt = 3�[0m
�[0;31mE (437949) my_espnow2: dt = 2�[0m
�[0;31mE (438130) my_espnow2: dt = 10�[0m
�[0;31mE (438336) my_espnow2: dt = 20�[0m
�[0;31mE (438509) my_espnow2: dt = 6�[0m
�[0;31mE (438674) my_espnow2: dt = 2�[0m
�[0;31mE (438848) my_espnow2: dt = 11�[0m
�[0;31mE (439023) my_espnow2: dt = 12�[0m
�[0;31mE (439198) my_espnow2: dt = 2�[0m
�[0;31mE (439362) my_espnow2: dt = 2�[0m
�[0;31mE (439534) my_espnow2: dt = 6�[0m
�[0;31mE (439704) my_espnow2: dt = 2�[0m
�[0;31mE (439896) my_espnow2: dt = 2�[0m
�[0;31mE (440063) my_espnow2: dt = 5�[0m
�[0;31mE (440254) my_espnow2: dt = 11�[0m
�[0;31mE (440414) my_espnow2: dt = 2�[0m
�[0;31mE (440581) my_espnow2: dt = 3�[0m
�[0;31mE (440772) my_espnow2: dt = 31�[0m
发送完成时间间隔十分随机,甚至有长达31ms的,有什么办法或者配置可以消除这种随机性,让数据可以立即发出么?
espnow发送存在延时该如何处理
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: No registered users and 168 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.