<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[lora.join does not attempt every 15 seconds in background]]></title><description><![CDATA[<p dir="auto">If lora.join fails on the first attempt, it does not attempt again every 15 seconds as suggested in <a href="https://docs.pycom.io/firmwareapi/pycom/network/lora#lora-join-activation-auth-timeout-none-dr-none" target="_blank" rel="noopener noreferrer nofollow">Pycom docs</a>.</p>
<p dir="auto">Example code:</p>
<pre><code>lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key),timeout=0)
# wait for a connection to be established
while not lora.has_joined():
    pass
</code></pre>
<p dir="auto">Which will hang forever if the first join fails (which happens to us often enough during educational workshops with LoPy4).</p>
<p dir="auto">The docs say <code>Internally the stack will automatically retry every 15 seconds until a Join Accept message is received.</code> - which implies no wizardry is needed for the 15s intervals to join.</p>
<p dir="auto">If I am overlooking something. any tips are welcomed!</p>
]]></description><link>https://forum.pycom.io/topic/3871/lora-join-does-not-attempt-every-15-seconds-in-background</link><generator>RSS for Node</generator><lastBuildDate>Tue, 18 Aug 2026 16:49:28 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/3871.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 15 Oct 2018 01:52:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Mon, 15 Oct 2018 01:53:39 GMT]]></title><description><![CDATA[<p dir="auto">If lora.join fails on the first attempt, it does not attempt again every 15 seconds as suggested in <a href="https://docs.pycom.io/firmwareapi/pycom/network/lora#lora-join-activation-auth-timeout-none-dr-none" target="_blank" rel="noopener noreferrer nofollow">Pycom docs</a>.</p>
<p dir="auto">Example code:</p>
<pre><code>lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key),timeout=0)
# wait for a connection to be established
while not lora.has_joined():
    pass
</code></pre>
<p dir="auto">Which will hang forever if the first join fails (which happens to us often enough during educational workshops with LoPy4).</p>
<p dir="auto">The docs say <code>Internally the stack will automatically retry every 15 seconds until a Join Accept message is received.</code> - which implies no wizardry is needed for the 15s intervals to join.</p>
<p dir="auto">If I am overlooking something. any tips are welcomed!</p>
]]></description><link>https://forum.pycom.io/post/22876</link><guid isPermaLink="true">https://forum.pycom.io/post/22876</guid><dc:creator><![CDATA[Graham]]></dc:creator><pubDate>Mon, 15 Oct 2018 01:53:39 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Mon, 15 Oct 2018 03:06:47 GMT]]></title><description><![CDATA[<p dir="auto">Fyi, here's my <code>os.uname()</code> on the LoPy4:</p>
<pre><code>sysname='LoPy4', nodename='LoPy4', release='1.18.1.r1', version='v1.8.6-849-b0520f1 on 2018-08-29', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1'
</code></pre>
]]></description><link>https://forum.pycom.io/post/22877</link><guid isPermaLink="true">https://forum.pycom.io/post/22877</guid><dc:creator><![CDATA[Graham]]></dc:creator><pubDate>Mon, 15 Oct 2018 03:06:47 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Mon, 15 Oct 2018 05:47:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3258">@graham</a> I do not agree. If I look at the traffic from a node, e.g. in the TTN console or at the gateway, you'll see join messages every 15 seconds. Which gateway are you using?</p>
]]></description><link>https://forum.pycom.io/post/22879</link><guid isPermaLink="true">https://forum.pycom.io/post/22879</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Mon, 15 Oct 2018 05:47:44 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Mon, 15 Oct 2018 07:30:32 GMT]]></title><description><![CDATA[<p dir="auto">It happens on different gateways, so I'm not leaning in that direction yet. I can very reliably trigger the fault by powering up 5x LoPy4's all at the same time. At least one or two of the last-to-be-powered devices will hang.</p>
<p dir="auto">The only semi-reliable method we have for educational workshops (where 10+ devices are being powered on/off at the same time) is this:</p>
<pre><code>print(&quot;Device EUI: &quot; + binascii.hexlify(lora.mac()).upper().decode('utf-8'))

while not lora.has_joined():
    # if no connection in a few seconds, then reboot
    if utime.time() &gt; 15:
        print(&quot;possible timeout&quot;)
        machine.reset()
    pass
</code></pre>
<p dir="auto">Although it looks and feels like a dity workaround for something that is breaking somewhere at the OS-level.</p>
<p dir="auto">Anyone with 5+ LoPy4's to test could replicate the issue easily and reliably. This failure state triggers all-the-time, it doesn't seem to be dependant on the Gateway model.</p>
<p dir="auto">If this happened to a device in the field, without our workaround, it would remain in a hung state indefinitely. That, erm, concerns me a little.</p>
]]></description><link>https://forum.pycom.io/post/22881</link><guid isPermaLink="true">https://forum.pycom.io/post/22881</guid><dc:creator><![CDATA[Graham]]></dc:creator><pubDate>Mon, 15 Oct 2018 07:30:32 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Mon, 15 Oct 2018 09:43:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3258">@graham</a> It looks for me as if two devices try to join at the same time over and over again, and then the join messages get lost due to collision. An indirect proof for that would be, if every device joins when started by itself. So the reset you used as workaround would then force the devices out of their malicious sync.</p>
]]></description><link>https://forum.pycom.io/post/22882</link><guid isPermaLink="true">https://forum.pycom.io/post/22882</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Mon, 15 Oct 2018 09:43:49 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Tue, 16 Oct 2018 09:38:54 GMT]]></title><description><![CDATA[<p dir="auto">What do you experience if you power up your gateway after the first join attempt? I seem to have the same issue. Only one join attempt</p>
]]></description><link>https://forum.pycom.io/post/22913</link><guid isPermaLink="true">https://forum.pycom.io/post/22913</guid><dc:creator><![CDATA[Harald]]></dc:creator><pubDate>Tue, 16 Oct 2018 09:38:54 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Tue, 16 Oct 2018 10:13:06 GMT]]></title><description><![CDATA[<p dir="auto">The firmware does repeat the join request.<br />
Uplink join frequency (in Mhz) depends of each regional specification same for retry frequency (in seconds)<br />
Depending on your setup (region in particular) you have to make a particular setup so what regional specification do you target ?<br />
Example for US_915 subband 1 you would OTAA join on channel 64 and then that would be:</p>
<pre><code>    lora.add_channel(int(upstream.get('chan')), frequency=int(upstream.get('fq')), dr_min=0, dr_max=int(data_rate))  
    for index in range(0, 71):
        if index != upstream.get('chan'):
            lora.remove_channel(index)


        # create an OTA authentication params
        dev_eui = binascii.unhexlify(self.config[&quot;lora&quot;][&quot;otaa&quot;]['dev_eui'])
        app_key = binascii.unhexlify(self.config[&quot;lora&quot;][&quot;otaa&quot;]['app_key'])
        nwk_key = binascii.unhexlify(self.config[&quot;lora&quot;][&quot;otaa&quot;]['nwk_key'])

        start_join_time = time.time()

        # lora.nvram_restore()

        if not lora.has_joined():
            if self.config[&quot;lora&quot;][&quot;region&quot;] == &quot;US915&quot;:
                lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_key, nwk_key), timeout=0, dr=0)
            else:
                lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_key, nwk_key), timeout=0, dr=int(self.config[&quot;lora&quot;][&quot;data_rate&quot;]))


        # wait until the module has joined the network
        while not lora.has_joined():
            time.sleep(1)
            pycom.rgbled(0x000000)
            print('.', end='')
            time.sleep(1)
            pycom.rgbled(0x0000ff)

        lora.nvram_save()



    for i in range(0, 8):
        fq = 902300000 + (i * 200000)
        self.lora.add_channel(i, frequency=fq, dr_min=0, dr_max=self.config[&quot;lora&quot;][&quot;data_rate&quot;])</code></pre>
]]></description><link>https://forum.pycom.io/post/22914</link><guid isPermaLink="true">https://forum.pycom.io/post/22914</guid><dc:creator><![CDATA[Emmanuel Florent]]></dc:creator><pubDate>Tue, 16 Oct 2018 10:13:06 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Wed, 17 Oct 2018 02:38:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3363">@harald</a> The Gateway (more specifically, TTN console data logs) show a single join event. No additional join events occur in TTN console after this issue is invoked (which suggests the LoPy4 is the issue).</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3384">@emmanuel-florent</a> I've omitted the region settings to just show the minimal code. We're heavy-users of LoPy hardware; everything upstream of the join event is fine.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/98">@robert-hh</a> I agree there is a collision, though it's not attempting every 15 seconds. A failed connection never recovers, even if other failed devices are turned off (leaving 1 failed device &quot;on&quot; to attempt its own recovery).</p>
<p dir="auto">It does appear more-and-more that there's an issue in the stack for this scenario. With REPL connected, sending a CTRL+C during a failure condition</p>
<p dir="auto">Left as is, this bug could be viewed as a DDoS layer for Pycom LoPy4. Devices that attempt to connect on power-up could find themselves in this situation and never &quot;connect&quot; using any of the recommended examples in Pycom Docs. I doubt many people have experienced the issue as they are not holding educational workshops that invoke more-than-normal LoRaWAN events over a short time.</p>
]]></description><link>https://forum.pycom.io/post/22927</link><guid isPermaLink="true">https://forum.pycom.io/post/22927</guid><dc:creator><![CDATA[Graham]]></dc:creator><pubDate>Wed, 17 Oct 2018 02:38:45 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Wed, 17 Oct 2018 05:42:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3258">@graham</a> I have never seen that behavior. Did you check that the various board you are using have a different dev-eui, when manually set?</p>
<p dir="auto">About Ctrl-C: The Lora stack/device is not fully reset on Ctrl-C. You have to push hard reset (button) or call machine.reset().</p>
]]></description><link>https://forum.pycom.io/post/22930</link><guid isPermaLink="true">https://forum.pycom.io/post/22930</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Wed, 17 Oct 2018 05:42:16 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Wed, 17 Oct 2018 16:41:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3258">@graham</a> please let me look the code for the workshop you can write me at emmanuel at pycom dot io.</p>
]]></description><link>https://forum.pycom.io/post/22954</link><guid isPermaLink="true">https://forum.pycom.io/post/22954</guid><dc:creator><![CDATA[Emmanuel Florent]]></dc:creator><pubDate>Wed, 17 Oct 2018 16:41:53 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Thu, 25 Oct 2018 02:33:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3384">@emmanuel-florent</a> here's the code. I've tested this many times with 4x LoPy4's before posting; pressing the reset button at the same time on them all. Almost always, one or two devices will not connect and do not recover.</p>
<p dir="auto">Gateway logs show 1 join request from the failed device(s), I watched the logs for two minutes each time awaiting any signs of life (there were none).</p>
<pre><code>from network import LoRa
import pycom
import binascii
import socket

lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.AS923)
app_eui = binascii.unhexlify('XXXXXXXXXXXXXX')
app_key = binascii.unhexlify('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')

lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0)

print('Waiting for LoRaWAN network connection...')
while not lora.has_joined():
    pass

print('Network joined!')

while True:
    pass
</code></pre>
]]></description><link>https://forum.pycom.io/post/23058</link><guid isPermaLink="true">https://forum.pycom.io/post/23058</guid><dc:creator><![CDATA[Graham]]></dc:creator><pubDate>Thu, 25 Oct 2018 02:33:02 GMT</pubDate></item><item><title><![CDATA[Reply to lora.join does not attempt every 15 seconds in background on Thu, 25 Oct 2018 05:27:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3258">@graham</a> said in <a href="/post/23058">lora.join does not attempt every 15 seconds in background</a>:</p>
<blockquote>
<p dir="auto">while not lora.has_joined():<br />
pass</p>
</blockquote>
<p dir="auto">I would add something like sleep(1) into the loop, giving the background tasks more time.</p>
]]></description><link>https://forum.pycom.io/post/23059</link><guid isPermaLink="true">https://forum.pycom.io/post/23059</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Thu, 25 Oct 2018 05:27:32 GMT</pubDate></item></channel></rss>