logo elektroda
logo elektroda
X
logo elektroda

[ESP8266] ESP8266 ESP12E Arduino: No UDP data after waking up from deep.sleep

korteksik 3312 15
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 15898478
    korteksik
    Level 10  
    Hello,
    I am using ESP12E and Arduino v.1.6.8

    Maybe some colleagues can find an explanation for my problem. Well, when I activate the transition to deep sleep mode in the program, I get nothing over UDP after waking up. However, when I activate the sleep mode, the programme runs like crazy. All UDP data is received.
    I would like to add, that after waking up from deep.sleep, the data after uart comes correctly.
    I have no idea what is wrong. I've probably searched all the links Uncle google spit out and nothing. I still don't know how to bite it....

    Here is the code:
    Code: C / C++
    Log in, to see the code


    Maybe someone has encountered a similar problem....

    ps. I tested the program on two different ESP12E and WROOM-02 modules - behaviour identical.

    Greetings
    Korteksik
  • ADVERTISEMENT
  • #2 15901217
    korteksik
    Level 10  
    Gee, no one can help? No one has encountered a similar problem????

    Perhaps a hint?
  • #3 15904859
    piotr411
    Level 22  
    Change the development environment, help will be found.
  • #4 15905022
    korteksik
    Level 10  
    Thanks for your reply piotr411,
    i understand you are suggesting LUA?
  • ADVERTISEMENT
  • #6 15905276
    piotr411
    Level 22  
    korteksik wrote:
    Thanks for your reply piotr411,
    i understand that you are suggesting LUA?


    I wasn't suggesting LUA, just a deviation from the predefined modules testing environment. There is C,Basic,Phyton, LUA available for ESP. Arduino is an ultra high level environment for ultra beginners. This is the philosophy of the gentlemen from Italy.

    Since Arduino is for ultra-beginners, and your question is about intermediate level, that's why you didn't get an answer. Beginners will not help you, and those who know something are not interested in Arduino ;-)
  • #7 15905987
    korteksik
    Level 10  
    Well, so after an initial introduction to LUA, I have begotten a UDP test program:
    Code: C / C++
    Log in, to see the code


    And the program works as it should - every time I run it, it connects to the WiFi network and sends one packet over UDP. Out of 100 attempts - 100 successful.
    When I unpublish the node.dsleep instruction then the ESP correctly puts itself to sleep and resets after 3s - but I get nothing over UDP....
    But I noticed one interesting thing - when the sleep instruction is active - even after a hardware reset nothing comes over UDP - yet it should, because entering sleep mode happens after the previous instructions are executed.... So I should at least get one packet over UDP before the ESP goes to sleep in the next instruction....
    It works exactly the same as with the Arduino....
    I don't understand any of this, maybe now there are some ideas????

    ps. ESP has this batch:
    NodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4

    ps.
    After more than an hour of sleep, 1 (one) package arrived. But I still don't know what to think about it....
    For 2 hours of working with sleep only this 1 package arrived.
  • #8 15908076
    korteksik
    Level 10  
    As I still haven't found a solution to my problem, and there aren't many people willing to help either - I have a question - has anyone tested sending data over UDP using the ESP's deep sleep mode?
    Theoretically I can get around my problem by adding an external ESP power control chip, but that's not the point....
  • ADVERTISEMENT
  • #9 15908171
    Anonymous
    Anonymous  
  • ADVERTISEMENT
  • #10 15908631
    piotr411
    Level 22  
    The problem is not directly related to sleep and dispatch after sleep. ESP sends its sometimes empty packets.
    I have some alternate solution written on Android to retrieve data from ESP flash memory. There is a similar problem. Randomly ESP sends packets and this can mess things up a bit.
    I can give you an example I use in some devices where Android exchanges data with ESP
    Code: VB.net
    Log in, to see the code
  • #11 15908711
    Anonymous
    Anonymous  
  • #12 15908734
    piotr411
    Level 22  
    Piotrus_999 wrote:
    piotr411 wrote:
    Randomly ESP sends packages and this can mess things up a bit.


    This example is incredibly primitively written - and on top of that I suspect it's largely "strung together" from the internet - you can see it from the mix of languages : once we have "data downloaded" and once we have "wait....."

    And the author's colleague's problem is putting it to sleep too early.


    "Wait" is momentarily displayed 300ms, this is the time to retry the transmission and check if the packet came empty.

    <ciach>

    Moderated By dondu:

    I cut out the unnecessary ones.

  • Helpful post
    #13 15908759
    Anonymous
    Anonymous  
  • #14 15909684
    korteksik
    Level 10  
    Piotrus_999 wrote:


    @korteksik In practically every processor you have to check if the operations you have ordered have been performed before going into such a sleep mode. If you "slaughter" the processor and periphery during this, then of course the transmissions will fail.


    Thank you for the hints! It turned out that adding a sizable delay solved the problem. Now UDP sending after waking up works almost 100% - almost, because after 4 hours of testing probably 2 packets didn't arrive ( and they were sent every 5s) - so not bad.
    I added a packet resend just in case.
    In LUA I added a delay on the timer:
    Code: C / C++
    Log in, to see the code


    I also tested the program in Arduino, after adding delays - it also works :)
    By trial and testing, the delay delay(1000); before the sleep instruction probably works.

    I don't know if this is the way it should be done - but it works.

    Thank you all for your help, and in particular to Piotrus_999

    Cortex
  • #15 15909701
    Anonymous
    Anonymous  
  • #16 15910620
    korteksik
    Level 10  
    Piotrus_999 wrote:
    see more from yield()


    Thanks, but I stayed with the arduino. Somehow I'm not feeling LUA :) After adding delays everything works as it should :)
    I close the topic thanking everyone for their interest in the topic.

    Greetings
    Korteksik
ADVERTISEMENT