Generate join accept message (OTAA mode) with MKRWAN 1300

Good day,

I'm using MKRWAN 1300 board to read data from a electrical meter (End device).

With the MKRWAN 1300 I receive the "Join request message" from the end device but in order to connect them i need to send the "join accept message" to the end device. the "join accept message" needs to be encrypted in AES in ECB mode. I have the APPKEY and the APPEUI.

How can I use the MKRWAN 1300 to accept join request and generate the join accept message (OTAA mode)?
Is there any library with this function?

Please follow this link to see the join procedure:

See the attached to see the join procedure flow

Best regards,
Merlin Pineda.

Hello @pmerlin, maybe I didn't got your point very clear.
Are you using the MKRWAN as a gateway? Can you describe, in general lines, your system architecture (Like: what is the end device, what is the gateway, what is the Network server...)?

I've been using MKRWAN as an end device and I have no major problems with the OTAA Join process. Actually, there is a problem that the modem doesn't answer the "AT+JOIN" untill it receives a JoinAccept, and the MKRWAN.h lib implements a 60 seconds timeout, but doesn't terminate the Join process.
On the happy path, everything works just fine.

By now, I can tell you that on MKRWAN platform there's no function to generate a JoinAccept message. As my understanding, the MKRWAN is meant to be an end device and therefore sends JoinRequest messages.

You asked already something similar: what you want is a gateway plus a network server, because what you need is normally implemented by a network server, not a gateway. The network server encrypts/decrypts packets and build them according to the LoRaWAN specification. The gateway just relays packets in one direction or the other.
If you want to implement this, you have to implement at least part of the LoRaWAN stack, plus gateway features. No single library doing all the work. And this just to avoid buying a 20$ platform like ESP32+LoRa on which you can install single channel gateway software, or a $69 full gateway like TTIG....

@Mitel

At first i wanted to have a Lora Gateway.

The MKRWAN is US$39
I also have a Dragino Gateway for US$80

But what i want to develop is a LoRa server without connecting to any LoRa server like the things network.

I just want to generate otaa accept message afte receiving the join request message, but there is not so much information about that topic.

Best regards,
Merlin Pineda

mjunior-fitec:
Hello @pmerlin, maybe I didn't got your point very clear.
Are you using the MKRWAN as a gateway? Can you describe, in general lines, your system architecture (Like: what is the end device, what is the gateway, what is the Network server...)?

I've been using MKRWAN as an end device and I have no major problems with the OTAA Join process. Actually, there is a problem that the modem doesn't answer the "AT+JOIN" untill it receives a JoinAccept, and the MKRWAN.h lib implements a 60 seconds timeout, but doesn't terminate the Join process.
On the happy path, everything works just fine.

By now, I can tell you that on MKRWAN platform there's no function to generate a JoinAccept message. As my understanding, the MKRWAN is meant to be an end device and therefore sends JoinRequest messages.

Hi,

The electrical meter is the end device
the MKRWAN 1300 i want to use as the "server"

I'm receiving the join request message from the meter, so i just need to generate the join accept message, so i was wondering if there is any code for generate it.

Best regards,
Merlin Pineda.

So, since you have a gateway, why you do not install an open source Lora Server on some web server (like the one provided by TTN, or Loraserver), register both the gateway and the node on it, and do everything the right way? It's not mandatory to have a public network. Join accept is only one part of the process...

pmerlin:
The electrical meter is the end device
the MKRWAN 1300 i want to use as the "server"

I'm sorry, but IMHO you're just trying to do it wrongly. If the meter is the end device and something is the gateway, you need a Network Server. As far as I know, if you're using LoRaWAN it's mandatory to have one (or more) gateway(s) and one Network server, this is the very basic. The entity responsible to deal with JoinRequest messages and check the keys and generate and dispatch JoinAccept messages is the Network Server. Also, in my opinion, MKRWAN1300 is probably one of the worst options to build a Network server.
The other option would be to use raw LoRa! Some kind of M2M protocol, in order to receive the meter's LoRa messages directly by your MKRWAN. But in this case you'll have to make the meter to comply with this and looks like you can't change the meter, so... Good luck!