Arudino Mega hangs when serial GW is down



  • Hi,
    I have a system since awhile ago. It reads the SHT sensor and controls the solenoid that sets up the water flow. I use the Arduino Mega board. All necessary configs and logs are on the SD card. Basically, it is an autonomous system, that waters my garden. Recently I decided to add the mySensor functionality, mostly because I was curious and had a number of RF24s that were just dusting. I installed OpenHab2 and enjoyed the near real time indication of temp and humidity in the web browser. Everything works reliable, I'm fine with it, but... when I start the system without the serial GW up and running, my Arduino Mega just hangs (actually trying to get in touch with the GW, which I see on Serial). Actually, the MySensors feature for my device is "good to have". I wonder if there is a way to configure the MySesnors library to just set the alarm pin for example, and then continue with the setup()? Just to be more relaxed?
    thankful for any tips.
    Mikhail


  • Hero Member

    @etxmsol
    The line of code needed to force your node to move on when no uplink is available

    #define MY_TRANSPORT_WAIT_READY_MS 3000
    

    Have a look at this post for details



  • thanks, it helped! One downside is that the node seems to abandon connecting attempts completely. It would be great if the connection is established as soon as the GW is up again. Right now it seems I need to restart all the nodes to get them connect to the GW.


  • Hero Member

    @etxmsol That should not be the case.
    As I understand it the node should still attempt to connect even after it has moved on.
    In the post I linked to tekka indicates that is how it is meant to work and although i have not given it extensive testing my nodes seem to re-connect without problem.



  • I did the test again, this time logging serial on the node. At 4277 and 4280 you see how the messages fail the first time. It is expected since the GW is down. Then I start the GW. There is no attempt to connect on the node's side. After one hour you can see how the node fails to send messages, this time the GW is up. The node does not seem to register during this hour. When I restart the node, the connection to the GW is established as it should. Maybe it is a bug?

    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=3000
    11 TSM:INIT:TSP OK
    13 TSM:INIT:STATID=2
    15 TSF:SID:OK,ID=2
    17 TSM:FPAR
    53 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2060 !TSM:FPAR:NO REPLY
    2062 TSM:FPAR
    2098 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    3006 MCO:BGN:STP
    3135 MCO:BGN:INIT OK,TSP=0
    4277 !MCO:SND:NODE NOT REG
    4280 !MCO:SND:NODE NOT REG
    3604282 !TSM:FPAR:NO REPLY
    3604285 TSM:FPAR
    3604322 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    3604328 TSF:MSG:READ,0-0-255,s=255,c=3,t=20,pt=0,l=0,sg=0:
    3604334 TSF:MSG:BC
    3605475 !MCO:SND:NODE NOT REG
    3605477 !MCO:SND:NODE NOT REG
    0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=3000
    11 TSM:INIT:TSP OK
    13 TSM:INIT:STATID=2
    15 TSF:SID:OK,ID=2
    17 TSM:FPAR
    53 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    814 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    819 TSF:MSG:FPAR OK,ID=0,D=1
    2060 TSM:FPAR:OK
    2061 TSM:ID
    2062 TSM:ID:OK
    2064 TSM:UPL
    2067 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2076 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2081 TSF:MSG:PONG RECV,HP=1
    2084 TSM:UPL:OK
    2085 TSM:READY:ID=2,PAR=0,DIS=1
    2091 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2097 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2105 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
    2113 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2139 TSF:MSG:READ,0-0-2,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2146 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=11,pt=0,l=12,sg=0,ft=0,st=OK:GardenMaster
    2156 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:2.0
    2164 TSF:MSG:SEND,2-2-0-0,s=1,c=0,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2171 TSF:MSG:SEND,2-2-0-0,s=2,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=OK:
    2178 MCO:REG:REQ
    2181 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2188 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2193 MCO:PIM:NODE REG=1
    2195 MCO:BGN:STP
    2323 MCO:BGN:INIT OK,TSP=1
    3467 TSF:MSG:SEND,2-2-0-0,s=1,c=1,t=1,pt=2,l=2,sg=0,ft=0,st=OK:96
    3475 TSF:MSG:SEND,2-2-0-0,s=2,c=1,t=0,pt=2,l=2,sg=0,ft=0,st=OK:24



  • @Boots33 said in Arudino Mega hangs when serial GW is down:

    de should still attempt to connect even after it has moved on.

    I have similar experience, only restart allows connecting the node to the gateway. I have not done any testing, but I found it out after my wife unplugged gateway couple of times as it is still powered by AC USB charger in power strip.


Log in to reply
 

382
Online

6.7k
Users

7.6k
Topics

80.4k
Posts

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.