-
Notifications
You must be signed in to change notification settings - Fork 13.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
UDP will not send until it has received at least one packet #1802
Comments
It would be really helpful if you could post the sketch which may be used to reproduce this issue! |
For the record, i think UDP should be able to send packets first. You can check NTPClient sample for the demonstration of it. |
Igrr, I attached the sketch file and the output from both the host and ESP. They are at the end of the post "zipfiles.zip". The NTPclient first uses DNS to get the IP address of the .gov server. I can try that, but not send the UDP request to time server. I'll see if that works. However, I was trying to design a UDP based program which wakes up, sends the data and goes back into deep sleep. Deep sleep is important for battery life. Depending on the amount of time awake vs asleep, It could make a battery last 60 times as long with sleep mode. I'll get back to you about using the Time Server to wake up UDP sends. |
Hi!
|
I tried the UDP timeserver, with a small modification. I ran the time server, got a valid IP for server and used the IP address of the server.- //get a random server from the pool The result was a long list like this - sending NTP packet... sending NTP packet... sending NTP packet... sending NTP packet... sending NTP packet... sending NTP packet... sending NTP packet... I cannot receive the NTP packet from server, because I have not actually send the packet. If I just change the program to - //get a random server from the pool I get the time with no problem. - Connecting to Phoenix sending NTP packet... Connecting to Phoenix sending NTP packet... If I trick the remote host that I'm using for temperature monitoring via UDP, into sending packets to port 2390, I get - sending NTP packet... sending NTP packet... sending NTP packet... sending NTP packet... sending NTP packet... sending NTP packet... sending NTP packet... sending NTP packet... sending NTP packet... Now my temp monitoring host has no idea about time servers, but the IP address is 192.168.1.105. Jim I suppose I could include the - command in my program. but I don't like the idea. I have 4 operational nodes, and ideas for several more. I don't think having a half dozen nodes asking for ntp server ip's is a good idea. |
OK, I reopened. I made a mistake |
Hi! |
I got SocketTest 3.0.0 and the results were the same as my host program. ESP will not speak unless spoken to. So I'm stuck. I see the problem that I reported is listed as troubleshooting, no milestones and no one assigned to it. Dunno, I'll just wait a few days. |
Sorry, I haven't noticed the sketch first time i extracted the archive. I loaded the sketch, made the following changes to fit my network environment:
Then fired up nc on my laptop, and saw packets coming in:
Output from serial monitor was:
and so on. So unfortunately I'm not able to reproduce this so far. In the end i think the issue you are seeing is due to |
Interesting. I just used - |
I can confirm that your example also works for me without WiFi.hostByName, once I change WiFi mode to WiFi_STA. |
I see that you get it to work. Since you do and I don't, maybe it is the ESP libraries. The library included with IDE version 1.6.8 is ESP8266 builtin by Simmon Peter,Markus Sattler,Ivan Grokhotkov version 1.0.0 ESP8266 sketches examples. I tried to click on the "more info" but nothing happens. I downloaded the zipfile from GitHub but the zip installer in the IDE says it is not a library. I can't find where Arduino installs the ESP8266 libraries. I've used Arduino IDE since version 0019, but the new library manager has managed to make it very difficult to upgrade. I have the .json file for ESP8266 in my preferences, but it seems to think this is the newest release. |
I went through your changes, made all of them. And yes, I did the Wifi.mode to STA |
How do I get the version of ESP8266 that you are using? It wasn't included with the install of IDE version 1.6.8, and it doesn't show up on the updatable list of libraries. |
You must be looking at library manager, not the boards manager. Boards manager is in Tools > Boards menu. |
I used sketch > include library > manage libraries for that snip I sent. Then looked at your instructions again. I went to TOOLS and the upgrade is there. I've upgraded, I think, but I have to go to my daughter's house, three hours away. and I won't be back until Monday. Arduino: 1.6.8 (Windows 7), Board: "Adafruit HUZZAH ESP8266, 80 MHz, Serial, 115200, 4M (3M SPIFFS)" Board huzzah (platform esp8266, package esp8266) is unknown Error compiling for board Adafruit HUZZAH ESP8266. This report would have more information with |
Oh, yes, I love the new boards manager !@#$%. |
First you need to remove 2.1.0-rc2, then change URL in preferences to the stable boards manager package url, and then install 2.1.0 version. |
However, I might not. Now the wonderful boards manager can't find the board. It shows me the board through the TOOLS menu but the compiler can't compile it. Board huzzah (platform esp8266, package esp8266) is unknown Error compiling for board Adafruit HUZZAH ESP8266. This report would have more information with |
Mostly it helps me to rename the folder Am 23.03.2016 um 16:27 schrieb jgrina:
|
I have two computers, The test computer is an old Win7, and the main computer is Win10. I went to the Win10 machine and loaded the ESP community version 2.1.0 I think this works. It has IDE version 1.6.5 on it. The program compiles and runs. It does not appear to need a awake up packet. I'd like to close this issue and straighten out the IDE version 1.6.8. Thanks, |
Basic Infos
Hardware
Hardware: Adafruit Huzzah, NodeMCU, Adafruit Feather
Core Version: 2.1
Description
Why does udp sendPacket wait for a received packet before sending? It is only the first send command that waits. If I force a transmit from host, a burst of "sent" packets appears and everything works great from there. Sends and receives go. I'm using Arduino IDE version 1.6.8 on a Win 7 machine for this listing, but the same happened with version 1.6.5 on my Win 10 machine. The ESP is an Adafruit Huzzah breakout board, but I also tried the ESP feather 8266 and the NodeMCU boards with the same result. I have updated the libraries to the latest code while installing IDE version 1.6.8.
The attached zipfiles are the program, monitor activity from the host and Arduino com port monitor
The arduino side file shows the ESP messages which have the sends, but no response until the host sends "!Start" message. The host side shows no messages until after the !Start message, then a burst of messages with responses to each message.
I've tried several WiFi.modes, plus udp.flush(), udp.stop(), commands, but nothing changes.
With a looping program, this is not a major problem, I can use the monitor send function to start the ESP8266 noodes, but I want to use battery power and deep sleep function for some nodes. Deep sleep erases any knowledge of previous packet receives, so it must receive a packet every time it wakes up.
Host side is Win 7, MegunoLink Pro
I am using the Timer function in MegunoLink to broadcast a "!Start" message every 1/2 second
Jim
Settings in IDE
Module: Huzzah, generic ESP, NodeMCU 1.0
Flash Size: 4Mb
CPU Frequency: 80mhz
Flash Mode: DIO
Flash Frequency: 40Mhz
Upload Using: serial
Reset Method: ck
zipfiles.zip
The text was updated successfully, but these errors were encountered: