houluy/lora-mote-emulator

Problem at OTAA Join Request

Opened this issue · 11 comments

Hi
I have trouble to parse Join Accept. I am tring with Helium Console. OTAA 1.0.2

pi@raspberrypi:~/deneme/lora-mote-emulator $ mote -v 1.0.2 join -n

2023-10-04 03:40:15,727 - INFO - Forming a join request message -
NwkKey: 01010101010101010101010101010101, AppKey: 01010101010101010101010101010101, AppEUI: a100000000000001, DevEUI: a100000000000001, DevNonce: 15, MIC: 3c55be3e,Final Join Req: 0001000000000000a101000000000000a10f003c55be3e --

2023-10-04 03:40:15,728 - INFO - Sending a PUSH DATA -
Verson: 02, Token: 2faf, Identifier: 00, GatewayEUI: aa555a0000000000

2023-10-04 03:40:15,730 - INFO - Receiving a PUSH ACK -
Version: 02, Token: 2faf, Identifier: 01

2023-10-04 03:40:18,033 - ERROR - Bad config file format, please copy a new file from template.

Where i did mistake?

houluy commented

Hi, please check the last line of log: ERROR - Bad config file format, please copy a new file from template.

You need to copy a configure file from the template file, and modify the configures according to your environment. All the configure templates are in the path src/template. Also, please notify that all the configure files are in JSON format. Make sure that the format is strictly correct as JSON format.

BTW, the LoRaWAN 1.0.2 is not fully tested, there may be some issues. Let me know if you run into sth bad.
Thanks!

houluy commented

Sorry, still cannot see the config files. For Join Req with 1.0.2 and OTAA, first to modify device infomation in device.json copied. An example:

{
    "Device": {
        "JoinEUI": "0000000000000000",
        "DevEUI": "0000000000000000"
    },
    "RootKeys": {
        "AppKey": "00000000000000000000000000000000",
        "NwkKey": "00000000000000000000000000000000"
    }
}

NOTE FOR V1.0: Set JoinEUI equal to AppEUI and set NwkKey equal to AppKey.

Then, use the following command:

mote pull
mote join -n

{
"Device": {
"JoinEUI": "A100000000000001",
"DevEUI": "A100000000000001"
},
"RootKeys": {
"AppKey": "01010101010101010101010101010101",
"NwkKey": "01010101010101010101010101010101"
}
}

This is my device config

mote pull
mote join -n

I tried. I got join accept. When try to send uplink data mic would be calculated wrong.

LoRa Motes Information:
DevEUI: a100000000000001
JoinEUI: a100000000000001
NwkKey: 01010101010101010101010101010101
AppKey: 01010101010101010101010101010101
Activation mode: OTAA
Activation status: True

DevAddr: 480002b8
FCntUp: 1
ACKed Downlink Count: 0
ACKed Uplink Count: 0
JSIntKey: 687e3f1556d30d8b722548e7b890088c
JSEncKey: 70f8024095ccf377bc142f682a8ccfa7
FNwkSIntKey: 7c0b01cf7e0efcd720e1f88fdc88cb2e
SNwkSIntKey: 7c0b01cf7e0efcd720e1f88fdc88cb2e
NwkSEncKey: 7c0b01cf7e0efcd720e1f88fdc88cb2e
AppSKey: 0b313bf730b82957b26b181166df9358
JoinNonce: c6aec7
DevNonce: 57
Rjcount0: 0
Rjcount1: 0
Last message has not been acknowledged yet

I have problem at uplink data.

Helium is using version 1.0.2.

I created device details at Helium like that

Device EUI : A100000000000001
App EUI : A100000000000001
App Key : 01010101010101010101010101010101

houluy commented

Might be some problems in code which is inconsistent with the protocol. Consider using ChirpStack (Docker deployment is very convenient) and V1.1 or check the MIC calculation process code (calcmic_app function in src/mac.py).