LoPy4 + pysense

Hello
I have Lopy4 + pysense and I try to use exaple from here https://github.com/brocaar/pycom-examples
I use Mikroik Lora Gateway (EU868), and ChirpStack on my serever
So, Server is working, Gateway is online, I defined profiles, all, device but from sme reson devise newer in online
So I set Device-profile LoraWAN MAC verison 1.1.0
Set aplication
Add devices (use devEUI from LoPy4) BUT on KEY OTAA tab thera are Aplication key and Network Key
Wish one I use ? I try combination but newer work

On python cone on LoPy4 i have this:

lora = LoRa(mode=LoRa.LORAWAN)

create an OTAA authentication parameters

app_eui = binascii.unhexlify(‘0000000000000000’)
app_key = binascii.unhexlify(‘cf05aea9675f558d59059ea0603ab034’)

print(“DevEUI: %s” % (binascii.hexlify(lora.mac())))
print(“AppEUI: %s” % (binascii.hexlify(app_eui)))
print(“AppKey: %s” % (binascii.hexlify(app_key)))

Any help.

Hi @Nemanja_Petrovic,
I believe the LoPy4 still only support LoRaWAN MAC version 1.0.2,

Change the version in your device profile and see if it connects.

Regards,

Hello
No. Still nothing.
My settup. Where I was wrong ?

indent preformatted text by 4 spaces

LoRaWAN regional band configuration.

Note that you might want to consult the LoRaWAN Regional Parameters

specification for valid values that apply to your region.

See: https://www.lora-alliance.org/lorawan-for-developers

[network_server.band]
name=“EU868”

LoRaWAN network related settings.

[network_server.network_settings]

# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
# available channels with additional channels (e.g. the EU band).
# The first 5 channels will be configured as part of the OTAA join-response
# (using the CFList field).
# The other channels (or channel / data-rate changes) will be (re)configured
# using the NewChannelReq mac-command.
#
[[network_server.network_settings.extra_channels]]
frequency=867100000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=867300000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=867500000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=86770000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=867900000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=868100000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=868300000
min_dr=0
max_dr=5
[[network_server.network_settings.extra_channels]]
frequency=867500000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=86770000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=867900000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=868100000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=868300000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=868500000
min_dr=0
max_dr=5


# Class B settings
[network_server.network_settings.class_b]
# Ping-slot data-rate.
ping_slot_dr=0

# Ping-slot frequency (Hz)
#
# Set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0
indent preformatted text by 4 spaces

channel

Settup in micropython (Lopy 4) using exaple of https://github.com/brocaar/pycom-examples

indent preformatted text by 4 spaces

lora = LoRa(mode=LoRa.LORAWAN)
create an OTAA authentication parameters

app_eui = binascii.unhexlify(‘00000000000000’)
app_key = binascii.unhexlify(‘cf05aea9675f558d59059ea0603ab034’)

print(“DevEUI: %s” % (binascii.hexlify(lora.mac())))
print(“AppEUI: %s” % (binascii.hexlify(app_eui)))
print(“AppKey: %s” % (binascii.hexlify(app_key)))
join a network using OTAA (Over the Air Activation)

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

Why all this need to be so complicated…
Used same exaple from https://github.com/brocaar/pycom-examples (LoPy4 + pysenes)
Gateway is seen on ChripSteck server, devise sends ERROR all the time…

On Device Data tab :
Error

Devices settup:

Micropython code main.py from example:
…
lora = LoRa(mode=LoRa.LORAWAN)

app_eui = binascii.unhexlify(‘0707070707070707’)
app_key = binascii.unhexlify(‘34b03a60a09e05598d555f67a9ae05cf’)

Log from Network Server:

print(“DevEUI: %s” % (binascii.hexlify(lora.mac())))
print(“AppEUI: %s” % (binascii.hexlify(app_eui)))
print(“AppKey: %s” % (binascii.hexlify(app_key)))
…
Output from device:
Pybytes connected successfully (using the built-in pybytes library)
Pybytes configuration read from /flash/pybytes_config.json
DevEUI: b’70b3d5499e220049’
AppEUI: b’0707070707070707’
AppKey: b’34b03a60a09e05598d555f67a9ae05cf’

I try to reverse input data fro app_key. Try to delete device and create again, reboot server. But all ti time have error message

Apr 19 18:13:44 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:13:44Z” level=info msg=“gateway/mqtt: gateway stats packet received” gateway_id=3234333615003c00 stats_id=f35f27c2-4c75-400a-aeb0-c595b0ac8fb2
Apr 19 18:13:44 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:13:44Z” level=info msg=“gateway updated” ctx_id=f35f27c2-4c75-400a-aeb0-c595b0ac8fb2 gateway_id=3234333615003c00
Apr 19 18:13:44 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:13:44Z” level=info msg=“finished client unary call” ctx_id=f35f27c2-4c75-400a-aeb0-c595b0ac8fb2 grpc.code=OK grpc.ctx_id=3dc2c30a-9b83-4e23-bed2-22e0e2c35f8e grpc.duration=5.396416ms grpc.method=HandleGatewayStats grpc.service=as.ApplicationServerService span.kind=client system=grpc
Apr 19 18:13:56 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:13:56Z” level=info msg=“gateway/mqtt: uplink frame received” gateway_id=3234333615003c00 uplink_id=7ce1b25d-e633-4854-b846-f008540b4ee4
Apr 19 18:13:56 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:13:56Z” level=info msg=“uplink: frame(s) collected” ctx_id=23a9c8f1-f743-4cc6-b8e0-0b2c7f82566c mtype=JoinRequest uplink_ids="[7ce1b25d-e633-4854-b846-f008540b4ee4]"
Apr 19 18:13:56 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:13:56Z” level=info msg=“finished client unary call” ctx_id=23a9c8f1-f743-4cc6-b8e0-0b2c7f82566c grpc.code=OK grpc.ctx_id=ec0fdab8-3cc9-442f-aa48-82abc425b2d9 grpc.duration=2.075557ms grpc.method=HandleError grpc.service=as.ApplicationServerService span.kind=client system=grpc
Apr 19 18:13:56 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:13:56Z” level=error msg=“uplink: processing uplink frame error” ctx_id=23a9c8f1-f743-4cc6-b8e0-0b2c7f82566c error=“join-request to join-server error: response error, code: MICFailed, description: invalid mic”
Apr 19 18:14:14 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:14:14Z” level=info msg=“gateway/mqtt: gateway stats packet received” gateway_id=3234333615003c00 stats_id=576c9998-af7b-4a0b-ba4e-e53dbe0860d9
Apr 19 18:14:14 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:14:14Z” level=info msg=“gateway updated” ctx_id=576c9998-af7b-4a0b-ba4e-e53dbe0860d9 gateway_id=3234333615003c00
Apr 19 18:14:14 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:14:14Z” level=info msg=“finished client unary call” ctx_id=576c9998-af7b-4a0b-ba4e-e53dbe0860d9 grpc.code=OK grpc.ctx_id=5f6dc477-bd70-48e7-a269-43557efebf07 grpc.duration=3.208098ms grpc.method=HandleGatewayStats grpc.service=as.ApplicationServerService span.kind=client system=grpc
Apr 19 18:14:16 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:14:16Z” level=info msg=“gateway/mqtt: uplink frame received” gateway_id=3234333615003c00 uplink_id=6d8ca1da-afc9-4637-aa33-0257f70da33f
Apr 19 18:14:16 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:14:16Z” level=info msg=“uplink: frame(s) collected” ctx_id=b9aa71d7-ef9c-4e9e-be59-ac47b92077c7 mtype=JoinRequest uplink_ids="[6d8ca1da-afc9-4637-aa33-0257f70da33f]"
Apr 19 18:14:16 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:14:16Z” level=info msg=“finished client unary call” ctx_id=b9aa71d7-ef9c-4e9e-be59-ac47b92077c7 grpc.code=OK grpc.ctx_id=d6a4ae5d-7948-460f-8893-4a6850e6f61f grpc.duration=2.154527ms grpc.method=HandleError grpc.service=as.ApplicationServerService span.kind=client system=grpc
Apr 19 18:14:16 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:14:16Z” level=error msg=“uplink: processing uplink frame error” ctx_id=b9aa71d7-ef9c-4e9e-be59-ac47b92077c7 error=“join-request to join-server error: response error, code: MICFailed, description: invalid mic”
Apr 19 18:14:44 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:14:44Z” level=info msg=“gateway/mqtt: gateway stats packet received” gateway_id=3234333615003c00 stats_id=e47dcf03-44f5-4816-8d3c-fee590c5c151
Apr 19 18:14:44 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:14:44Z” level=info msg=“gateway updated” ctx_id=e47dcf03-44f5-4816-8d3c-fee590c5c151 gateway_id=3234333615003c00
Apr 19 18:14:44 ubuntu_server chirpstack-network-server[791]: time=“2020-04-19T18:14:44Z” level=info msg=“finished client unary call” ctx_id=e47dcf03-44f5-4816-8d3c-fee590c5c151 grpc.code=OK grpc.ctx_id=c74c9e67-bdd4-4d48-bdf4-a9b9589b9631 grpc.duration=5.618316ms grpc.method=HandleGatewayStats grpc.service=as.ApplicationServerService span.kind=client system=grpc

How to solve this, any idea ? Not even one I secessfully add device to ChirpStack. On TTN it work easly.

Hi,

change your micropython code

from: app_key = binascii.unhexlify(‘34b03a60a09e05598d555f67a9ae05cf’)
to this: app_key = binascii.unhexlify(‘cf05aea9675f558d59059ea0603ab034’)

Regards

Hello
Try that…same problem. Turn OFF and ON device, reboot server… Same problem…same error

can you paste your securitron_devices profile

Yes, of course.

Devices1

…profile looks good… to be honest I’m using the US915 regional parms… but I had a lot of problems to activate my devices until I add this code, to deactivate the full channel used by pycom LOPY4

if it can help on your side…

    #remove all the channels
    for channel in range(0, 72):
        self.lora.remove_channel(channel)


    self.lora.add_channel(0, frequency=902300000, dr_min=0, dr_max=3)
    self.lora.add_channel(1, frequency=902500000, dr_min=0, dr_max=3)
    self.lora.add_channel(2, frequency=902700000, dr_min=0, dr_max=3)
    self.lora.add_channel(3, frequency=902900000, dr_min=0, dr_max=3)
    self.lora.add_channel(4, frequency=903100000, dr_min=0, dr_max=3)
    self.lora.add_channel(5, frequency=903300000, dr_min=0, dr_max=3)
    self.lora.add_channel(6, frequency=903500000, dr_min=0, dr_max=3)
    self.lora.add_channel(7, frequency=903700000, dr_min=0, dr_max=3)
    self.lora.add_channel(64, frequency=903000000, dr_min=4, dr_max=4)

Where you add this code ? In node (LoPy4) in main.py

Setup of netwok server

LoRaWAN network related settings.

[network_server.network_settings]

# Extra channel configuration.
#
# Use this for LoRaWAN regions where it is possible to extend the by default
# available channels with additional channels (e.g. the EU band).
# The first 5 channels will be configured as part of the OTAA join-response
# (using the CFList field).
# The other channels (or channel / data-rate changes) will be (re)configured
# using the NewChannelReq mac-command.
#
[[network_server.network_settings.extra_channels]]
frequency=867100000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=867300000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=867500000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=86770000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=867900000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=868100000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=868300000
min_dr=0
max_dr=5

[[network_server.network_settings.extra_channels]]
frequency=868500000
min_dr=0
max_dr=5

 # Scheduler settings
#
  # These settings affect the multicast, Class-B and Class-C downlink queue
 # scheduler.
  [network_server.scheduler]
 # Scheduler interval
 #
 # The interval in which the downlink scheduler for multicast, Class-B and
 # Class-C runs.
  scheduler_interval="1s"

 # Class-C settings.
 [network_server.scheduler.class_c]
  # Downlink lock duration
  #
  # Contains the duration to lock the downlink Class-C transmissions
 # after a preceeding downlink tx (per device).
   downlink_lock_duration="2s"

    # Multicast gateway delay.
    #
    # In case of a multi-gateway multicast downlink, this delay will added to
    # the transmission time of each downlink to avoid collisions between overlapping
    # gateways.
    multicast_gateway_delay="2s"

Hi, did you get it to work? I am using CN470 and I am encountering some other prblems. Just wondering if you managed to sove your problems.

No. Still same problem

1 Like

I am fancing the same error here in AU915, do you solve that?