<?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[Multicast and Class C]]></title><description><![CDATA[<p dir="auto">Hi everyone</p>
<p dir="auto">I have a Lopy4 as a end node connected to the TTN Stack. The LoPy is in class C using ABP mode. When I try to send a downlink to the LoPy it works fine when operating in DR=0 but with other DR like DR1, DR2, etc the message is not received by the LoPy. Does anyone know what could be the cause of this behavior.</p>
<pre><code>from network import LoRa
import socket
import ubinascii
import struct
import time

# Initialize LoRa in LORAWAN mode.
lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.EU868, device_class=LoRa.CLASS_C)

dev_addr = struct.unpack(&quot;&gt;l&quot;, ubinascii.unhexlify('018BB000'))[0] # these settings can be found from TTN
nwk_swkey = ubinascii.unhexlify('A68055259032482CEFDE6EEB47FA55000') # these settings can be found from TTN
app_swkey = ubinascii.unhexlify('FF1985009901BED302D867EBBDD27000') # these settings can be found from TTN

# join a network using ABP (Activation By Personalisation)
lora.join(activation=LoRa.ABP, auth=(dev_addr, nwk_swkey, app_swkey))

# remove all the non-default channRels
for i in range(3, 16):
    lora.remove_channel(i)

# set the 3 default channels to the same frequency
lora.add_channel(0, frequency=868100000, dr_min=0, dr_max=5)
lora.add_channel(1, frequency=868100000, dr_min=0, dr_max=5)
lora.add_channel(2, frequency=868100000, dr_min=0, dr_max=5)

# create a LoRa socket
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)

#works fine
s.setsockopt(socket.SOL_LORA, socket.SO_DR, 0)

#Does not work with DR=5
# s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)

s.setblocking(True)

# send some data
s.send(bytes([0x01, 0x02, 0x03]))

# make the socket non-blocking
s.setblocking(False)

&quot;&quot;&quot; Your own code can be written below! &quot;&quot;&quot;
while True:
    # s.send(bytes([0x01, 0x02, 0x03]))
    time.sleep(2)
    rx = s.recv(1024)
    stats = lora.stats()
    print(stats.tx_frequency)
    if rx:
        print(rx)
    time.sleep(2)
</code></pre>
<p dir="auto">Thank you</p>
]]></description><link>https://forum.pycom.io/topic/6953/multicast-and-class-c</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 02:13:34 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/6953.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 06 Apr 2021 10:37:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Multicast and Class C on Tue, 06 Apr 2021 10:38:27 GMT]]></title><description><![CDATA[<p dir="auto">Hi everyone</p>
<p dir="auto">I have a Lopy4 as a end node connected to the TTN Stack. The LoPy is in class C using ABP mode. When I try to send a downlink to the LoPy it works fine when operating in DR=0 but with other DR like DR1, DR2, etc the message is not received by the LoPy. Does anyone know what could be the cause of this behavior.</p>
<pre><code>from network import LoRa
import socket
import ubinascii
import struct
import time

# Initialize LoRa in LORAWAN mode.
lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.EU868, device_class=LoRa.CLASS_C)

dev_addr = struct.unpack(&quot;&gt;l&quot;, ubinascii.unhexlify('018BB000'))[0] # these settings can be found from TTN
nwk_swkey = ubinascii.unhexlify('A68055259032482CEFDE6EEB47FA55000') # these settings can be found from TTN
app_swkey = ubinascii.unhexlify('FF1985009901BED302D867EBBDD27000') # these settings can be found from TTN

# join a network using ABP (Activation By Personalisation)
lora.join(activation=LoRa.ABP, auth=(dev_addr, nwk_swkey, app_swkey))

# remove all the non-default channRels
for i in range(3, 16):
    lora.remove_channel(i)

# set the 3 default channels to the same frequency
lora.add_channel(0, frequency=868100000, dr_min=0, dr_max=5)
lora.add_channel(1, frequency=868100000, dr_min=0, dr_max=5)
lora.add_channel(2, frequency=868100000, dr_min=0, dr_max=5)

# create a LoRa socket
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)

#works fine
s.setsockopt(socket.SOL_LORA, socket.SO_DR, 0)

#Does not work with DR=5
# s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)

s.setblocking(True)

# send some data
s.send(bytes([0x01, 0x02, 0x03]))

# make the socket non-blocking
s.setblocking(False)

&quot;&quot;&quot; Your own code can be written below! &quot;&quot;&quot;
while True:
    # s.send(bytes([0x01, 0x02, 0x03]))
    time.sleep(2)
    rx = s.recv(1024)
    stats = lora.stats()
    print(stats.tx_frequency)
    if rx:
        print(rx)
    time.sleep(2)
</code></pre>
<p dir="auto">Thank you</p>
]]></description><link>https://forum.pycom.io/post/37792</link><guid isPermaLink="true">https://forum.pycom.io/post/37792</guid><dc:creator><![CDATA[mthethwansm]]></dc:creator><pubDate>Tue, 06 Apr 2021 10:38:27 GMT</pubDate></item><item><title><![CDATA[Reply to Multicast and Class C on Wed, 07 Apr 2021 09:14:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/5122">@mthethwansm</a> How are you sending the downlink (through TTN?) and when? Also the fact that you are setting all channels to a single frequency makes me think you are using another LoPy as a nano-gateway, is that the case?</p>
<p dir="auto">What settings does TTN show for the downlink?</p>
<p dir="auto">A class C device uses the settings of the RX2 window for most of the time (it switches to RX1 only during the original RX1 window).</p>
<p dir="auto">According to the LoRaWAN regional parameters spec, for EU868:</p>
<blockquote>
<p dir="auto">The RX2 receive window uses a fixed frequency and data rate. The default parameters are 869.525 MHz / DR0 (SF12, 125 kHz)</p>
</blockquote>
<p dir="auto">Other settings can be sent by the network using the <code>RXParamSetupReq</code> MAC command.</p>
<p dir="auto">So the question here is: is the LoPy not listening with the right settings, or is TTN or the gateway sending with the wrong settings? You should be able to determine the answer to the latter by examining TTN and gateway logs, which would be a starting point.</p>
<p dir="auto">Also, what firmware version are you using?</p>
<p dir="auto">Finally, you should edit your post and remove your keys and device IDs from the source.</p>
]]></description><link>https://forum.pycom.io/post/37796</link><guid isPermaLink="true">https://forum.pycom.io/post/37796</guid><dc:creator><![CDATA[jcaron]]></dc:creator><pubDate>Wed, 07 Apr 2021 09:14:25 GMT</pubDate></item><item><title><![CDATA[Reply to Multicast and Class C on Wed, 07 Apr 2021 16:32:16 GMT]]></title><description><![CDATA[<p dir="auto">Thank you <a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/1538">@jcaron</a> . The issue was on the TTN settings, the downlinks were only sent at the DR0/SF12 even if were configured to be sent at DR3/SF9 on TTN, fortunately I was able to solve that, now I can successfully receive data on DR0/SF12 and DR3/SF9.</p>
<p dir="auto">I have used fake keys and the fake device ID from the source code.</p>
]]></description><link>https://forum.pycom.io/post/37801</link><guid isPermaLink="true">https://forum.pycom.io/post/37801</guid><dc:creator><![CDATA[mthethwansm]]></dc:creator><pubDate>Wed, 07 Apr 2021 16:32:16 GMT</pubDate></item></channel></rss>