-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
ESPNOW Round trip takes 6 milliseconds (IDFGH-889) #3238
Comments
Issue resolved by setting a specific data rate:
Add this line to your code to set the fastest data rate: Im now getting under 700 Microsecond round trip times! |
Im not using ESP NOW, but i think this could be implemented in library somehow. @projectgus |
|
@leonyuhanov this header is not suppose to be used by the users: |
Understood. What do you suggest? This topic has been sitting open for over a month with no input... |
@leonyuhanov If the workaround that you're using works now then I suggest continuing to use it. Possibly the internal API will change in the future and this workaround will stop working, possibly it won't. I'm going to reopen the issue. It's assigned to a WiFi team engineer for them to take a look at. We want ESP-NOW performance on ESP32 to be similar or better than ESP8266. It may take a while before an official solution is available, though. |
@projectgus Thankyou!!! |
@leonyuhanov Sorry for reply late. You can call |
@leonyuhanov |
I sent a packet from 1 node with the time stamp, then waited for it to come back from node 2, then did the math. FYI yiu can change the data rate as mentioned in the coments above |
Yes, I can use |
the 8266 doesnt have these features in the backend on the espidf sdk, they r new to the esp32. the esp8266 was set to full speed |
I'm sorry, I think you didn't understand my question.
My question is how you get this result? |
The esp8266 arduino sdk has no bgn chanel bandwith limit or any way to change them, thus it runs at full abgn speed (150mbit if ure ap supports it) the esp32 skd gives you the abiloty to change speed from 1mb all the way up to full speed. read uo the sdk on the espressif web page |
I got it, thank you for your explanation. So you use 150Mbps to test the 8266 at first. |
Correct although i cant confirm it was acyualy 150mbs im just assuming that was the top speed based on bgn specs. FYI feel free to look through my examples of this for Arduino here https://github.com/leonyuhanov/ESP-NOW-TX-RX and espidf here https://github.com/leonyuhanov/ESP32_ESPIDF_ESPNOW |
Thanks very much for your examples. |
Hi @leonyuhanov Please replace libpp.a and try again. send me the log. https://github.com/esp8266/Arduino/tree/d24a358817f0c11f7087b3c8acbf24629b15998f/tools/sdk/lib Thanks! |
@Junhao-Espressif Will give it ago this week & get back to you |
@Junhao-Espressif Can you please confirm something for me: |
FYI i replaced it in the Ardunio SDK and got this (i put the error log in a file) https://github.com/leonyuhanov/ESP32_ESPIDF_ESPNOW/blob/master/ErrorLog |
Hi @leonyuhanov |
OK done as advised. failed to compile with these errors |
Please do not compile ESP32 example with ESP8266 SDK |
@Junhao-Espressif this issue has nothing to do with the 8266? Its specifically an issue with the ESP32 as mentioned originally. I have no speed constraints with the esp8266 |
@Junhao-Espressif As I understand it, the register 0x3ff20c00 contains a MICROSECOND timer. Seems to be pretty on point with my timing system. No idea why reading it slows down the round trip so much though. Without it im averaging 1000 micros. Can you elaborate on what your trying to ascertain? |
@Junhao-Espressif
Without the reg call avg RTT is 1227micros
|
Hi @leonyuhanov Could you test again: |
@Junhao-Espressif You can do the math yourself mate :) Can you please elaborate on what this is trying to achieve for your troubleshooting? |
Hi @leonyuhanov I want to prove that ESP8266 and ESP32 take the same time. ESP8266 and ESP32 both send and receive messages at a rate of 1Mbps The package sent by espnow contains the following content; 290bytes * 8 / 1Mbps = 2.32ms. Sending and receiving data requires at least 2.32 * 2 = 4.64ms |
The data length is 100bytes in ESP8266?
|
@Junhao-Espressif I understand,
|
OK just for arguments sake i have updated the code as you have suggested:
Rund trip times are still averaging at 1.5Mili seconds not 6 or over. Infact the largest im getting is 4.1milis |
@leonyuhanov For the ESP32, as mentioned earlier, you can call |
@zhangyanjiaoesp No worries. The esp8266 also has some similar rate fix functions but i cant get any of them to do anything for the espnow configuration. But this isnt relevant to this issue |
Since this issue has been solved, I think you can close it. Thank you once again. |
@zhangyanjiaoesp according to @projectgus this isnt a resolution. He reopened it. I think you need to make this part of the lib |
@leonyuhanov @projectgus |
@zhangyanjiaoesp ok good news |
Where is |
Hi |
For anyone who is still looking for an answer to this, |
I have been editing my code, but it seems not working. So, I want to determine how to measure latency/delay between the RX/TX and display it on the TX serial monitor. #define CS_PIN 5 // Chip Select Pin /unsigned long wasMillis = millis(), elapsedMillis = 0; #define CHANNEL 1 // Replace with your receiver MAC address ADXL345_WE myAcc = ADXL345_WE(CS_PIN, spi); } struct_message; struct_message myData; //callback when data is sent void setup() { } void loop() { xyzFloat raw = myAcc.getRawValues(); // Wait for 1/3200 seconds (sampling period) myData.id = 1; |
This is the receiver code #define CHANNEL 1 // Structure example to receive data } struct_message; // Create a struct_message called myData // Create a structure to hold the readings from each board // Create an array with all the structures // callback function that will be executed when data is received //Serial.print("acc_x:"); Serial.print(boardsStruct[myData.id - 1].x); void setup() { //Set device as a Wi-Fi Station //Init ESP-NOW // Once ESPNow is successfully Init, we will register for recv CB to void loop() { }` |
Since this is one of the top search results for this issue, I thought it might be worth adding a note. The relevant APIs have changed since this issue was raised, and using esp_wifi_internal_set_fix_rate is no longer effective. Something along the following lines can be used instead:
|
@JBKingdon I get the error -
Is there any additional library that needs to be imported other than the following two -
I am using arduino ide/platformio to burn to esp32 |
|
I'm sorry to ask a question unrelated to this issue, but I really need: Is this a wireless packet capture tool? What tool is this? |
@nanshenwei i dont know what that screenshot is from, i dis not post it :) |
Thank you for such a prompt reply. I apologize for disturbing you, as I didn't notice that your ID was mentioned in the referenced reply. I think I should have mentioned @nemonote01, because the screenshot came from his reply. Additionally, I am using ESPNOW to transmit data at 1ms intervals, sending a 200-byte payload data to a broadcast MAC address every 1ms, then flipping an LED. I've noticed that the LED does not flip as expected (I was expecting an oscilloscope to show about a 500Hz square wave), the waveform frequency appears to be between 400-500Hz momentarily.(sometimes much lower than 500Hz) So, I want to check where the problem might be (perhaps my wireless RF environment is too crowded). I'm also unsure under what conditions the ESPNOW sends the callback function after transmission completion. I have already turned "WiFi AMPDU TX" & "WiFi AMPDU RX" off, and successfully executed esp_wifi_config_espnow_rate(WIFI_IF_STA, WIFI_PHY_RATE_MCS7_SGI); |
@nanshenwei Please create a new ticket to report your issue. The screenshot seems to be a wireless packet capture from Omnipeek, you can also capture packets using the Wireshark. |
Thanks so much |
@nanshenwei please check this issue I had raised in esp_now - espressif/esp-now#115. I tried to publish at a rate of 10ms, but esp_now cannot publish at a rate of less than 20ms. What happens it at frequencies of more than 50Hz, the delay's keep on going up. You cannot publish at a rate less than 20ms. based on the software limit i believe. Please do tell me if you find a better solution. |
Environment
Problem Description
I have 2 ESP32 nodes a Sender and a Receiver.
The Sender sends 250 bytes, and starts a microsecond timer awaiting a reply from the receiver
My round trip times are between 5,400 - 7,500 microseconds
Size of the packet doesn't modify the time
This seems rather slow compared to the ESP8266 (even in the Arduino env) can get under 1 millisecond round trips like this.
Expected Behavior
Under 1000 microsecond round trip
Actual Behavior
My round trip times are between 5,400 - 7,500 microseconds
Code
Transmiter: https://github.com/leonyuhanov/ESP32_ESPIDF_ESPNOW/tree/master/espnowv1
Receiver: https://github.com/leonyuhanov/ESP32_ESPIDF_ESPNOW/tree/master/espnowv2
The text was updated successfully, but these errors were encountered: