OTAA Join status showing NOT_JOINED after power cycle RN2483

(Interravikram) #1

Hi everyone
I am using RN2483 with a frimware version of 1.0.4.

Expected Flow
Init Lora
Send Data
Turn RN2483 Off.

Turn RN2483 on
Send Data
RN2483 off
Turn RN2483 on
Send Data
RN2483 off

But if i don’t reinitialize the LORA module after turning it ON , The response from LoRa device is not_joined.
However if i initialize the LoRa module , It works fine.
Because of reintialization , the downlink message gets enqueued everytime a uplink message is received , resulting into multiple downlink messages.
And also i see retry before the message which is not normal

Best approach to OTAA join for multiple devices turning ON at the same time
(Jac Kersing) #2

The reinitialize cause the node to rejoin which causes a join response. (Your node can not join endlessly, joins use a random nonce which needs to be unique, after a few hundred joins you will start to see collisions resulting in failing joins)
The downlink seems to be generated by your application.

In your flow I do not see any save commands. You would need to save after every transmission, however this will cause significant wear on the eeprom device.

How much power is your node using? The RN2483 uses microamps when put to sleep, is that significant usage compared to the other components?

(Interravikram) #3

After joining once , i use mac save command.
Flow is like the below

Init RN2483
mac save
Turn OFF RN2483(By cutting the power supply)

Send Data (This command returns not_joined)
Turn OFF LoRa RN2483

(Arjan) #4

I’m quite sure that after powering up you need to run mac join abp, to use the OTAA Join Accept settings that were saved by mac save? That’s at least how I’ve been doing it.

Still then, you’ll run into frame counter problems if you do not also issue mac save after each and every uplink. See @kersing’s thoughts on EEPROM wear above!

And probably not relevant for 1.0.4, but:

(Interravikram) #5

I tried using dummy values for ABP and then calling abp join , but , nope it doesn’t work for me

(Arjan) #6

What exactly did you try? Forget the dummy values for now. (That’s only after a factory reset, and before doing the OTAA join. Setting them after you did the OTAA join will of course replace the secrets that were received in the OTAA Join Accept.)

So: first just try mac join abp after powering up the device, when before powering down it joined using mac join otaa.

(Interravikram) #7

Here are the commands that i am using for OTAA join and to send data

Turn ON LoRa Module

sys reset
mac reset 868
sys set pindig GPIO0 1
sys get hweui
mac set deveui
mac set appkey
mac set adr on
mac set ar off
mac set pwridx 1
mac set dr 5
mac set rx2 3 869525000
sys set pindig GPIO0 0
mac join otaa
mac save

Turn OFF RN2483

mac tx uncnf 1 hello_world(This returns not_joined if i don’t re-join using mac join otaa,works fine if i reinit or rejoin )
Turn OFF RN2483

(Arjan) #8

So, please try:

mac join otaa
mac save

Turn OFF RN2483

mac join abp
mac tx uncnf 1 010203
Turn OFF RN2483

Unrelated, but above I’ve also replaced the text “hello world” with the 3 bytes 010203. Don’t send text.

Also, when using OTAA, you should not use:

mac set rx2 3 869525000

(Interravikram) #9

nope , no help , It says Keys_not_init and then i can’t also see any message on my application on TTN

(Interravikram) #10

The frames up on TTN is always zero , though there are messages on the application with reinit and send configuration

(Arjan) #11

I don’t see any mac set appeui? Then your mac join otaa should not show any success in TTN Console either? Please try to send something right after mac join otaa:

mac set deveui …
mac set appeui …
mac set appkey …

mac join otaa
mac save
mac tx uncnf 1 010203
mac save

If the above works, but mac join abp still gives you:

then you might also need the workaround with the dummy values, before the OTAA join:

mac set deveui …
mac set appeui …
mac set appkey …
mac set devaddr 00000000
mac set nwkskey 00000000000000000000000000000000
mac set appskey 00000000000000000000000000000000

mac join otaa
mac save

If things then still don’t work, then please show your full list of commands again.

(Interravikram) #12

LORA RESET : RN2483 1.0.4 Oct 12 2017 14:59:25
LORA CMD:—> mac reset 868
:: ok
LORA CMD:—> sys set pindig GPIO0 1
:: ok
LORA CMD:—> sys get hweui
:: 0004A30B00243830
LORA CMD:—> mac set deveui 0004A30B00241830
:: ok
LORA CMD:—> mac set appeui 7023D57ED0019F02
:: ok
LORA CMD:—> mac set appkey 0004530B002418300004A30B00241830
:: ok
LORA CMD:—> mac set adr on
:: ok
LORA CMD:—> mac set ar off
:: ok
LORA CMD:—> mac set pwridx 1
:: ok
LORA CMD:—> mac set dr 5
:: ok
LORA CMD:—> sys set pindig GPIO0 0
:: ok
LORA CMD:—> mac join otaa
:: ok
LORA CMD:—> mac save
:: ok
Lora Message is ok
mac_rx 1 FA0019

Power OFF LoRa
Power ON LoRa
LORA CMD:—> mac tx uncnf 1 54
Lora Message is not_joined

As per the rn2483 command refernece , the RN2483 module should save the join state information,

What i have tried:
LORA CMD:—> sys reset
RN2483 1.0.4 Oct 12 2017 14:59:25

LORA CMD:—> mac tx uncnf 1 54
Lora Message is (Not joined )

(Arjan) #13

I still don’t see the mac join abp after the power on, or after the reset (assuming that the sys reset does not wipe the credentials you got from mac join otaa, after which mac join abp would not work anymore either).

So, again:


what gateway do you use ? just curieus

(Interravikram) #18

IMST with raspi

“gateway_conf”: {
“gateway_ID”: “B827EBFFFE379A60”,
“servers”: [
“server_address”: “router.eu.thethings.network”,
“serv_port_up”: 1700,
“serv_port_down”: 1700,
“serv_enabled”: true

(Arjan) #19

I feel like a broken record…

(Interravikram) #20

Ohh , Okay :+1:

(Arjan) #23

That should indeed work even without saving anything. You will run out of random DevNonce values though. (And in the future 1.1 that nonce is a sequence number, for which your device needs to keep track of which it already used, so then saving is required.)

However, to avoid the repeated OTAA join, one can tell it to do ABP instead. (Which is not really a join; it just loads the AppSKey, NwkSKey and DevAddr it calculated from the OTAA Join Accept, if those were saved. And apparently that also still needs one to initialize those values with some dummies.)

Or to avoid the need for any join, don’t remove all power after every send cycle, like @kersing suggested.

(Arjan) #24

:warning: @interravikram I am undeleting some posts you deleted, for future reference. Please don’t do that again.

(Interravikram) #26

It did the job for me , Thanks for your help :+1 :slight_smile: