Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

second join always ends in rx 2 timeout #41

Open
smalltoe opened this issue Aug 31, 2023 · 7 comments
Open

second join always ends in rx 2 timeout #41

smalltoe opened this issue Aug 31, 2023 · 7 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@smalltoe
Copy link

I have this reproducable pattern:
Step 1: I reset pico with flash_nuke.uf2
Step 2: I flash and run otaa_temperature_led.uf2
Step 3: I disconnect/reconnect power from pico and run otaa_temperature_led.uf2

Step 1 and Step 2 run flawless (DevEui is masked):

Pico LoRaWAN - OTAA - Temperature + LED

Erasing NVM ... success!
Initilizating LoRaWAN ... DevEui      : XX-XX-XX-XX-XX-XX-XX-XX
JoinEui     : 00-00-00-00-00-00-00-00
Pin         : 00-00-00-00

success!
Joining LoRaWAN network ...
###### =========== MLME-Request ============ ######
######               MLME_JOIN               ######
###### ===================================== ######
STATUS      : OK
........
###### =========== MLME-Confirm ============ ######
STATUS      : OK
###### ===========   JOINED     ============ ######

OTAA

DevAddr     :  01481CFE


DATA RATE   : DR_0


###### ============ CTXS STORED ============ ######
Size        : 2208

. joined successfully!
sending internal temperature: 20 °C (0x14)...
###### =========== MCPS-Request ============ ######
######           MCPS_UNCONFIRMED            ######
###### ===================================== ######
STATUS      : OK
success!

###### =========== MCPS-Confirm ============ ######
STATUS      : OK

###### =====   UPLINK FRAME        1   ===== ######

CLASS       : A

TX PORT     : 2
TX DATA     : UNCONFIRMED
14

DATA RATE   : DR_0
U/L FREQ    : 867300000
TX POWER    : 0
CHANNEL MASK: 00FF

In step 3 the device cannot join:

Pico LoRaWAN - OTAA - Temperature + LED

Erasing NVM ... success!
Initilizating LoRaWAN ... DevEui      : XX-XX-XX-XX-XX-XX-XX-XX
JoinEui     : 00-00-00-00-00-00-00-00
Pin         : 00-00-00-00

success!
Joining LoRaWAN network ...
###### =========== MLME-Request ============ ######
######               MLME_JOIN               ######
###### ===================================== ######
STATUS      : OK
.......
###### =========== MLME-Confirm ============ ######
STATUS      : Rx 2 timeout
############################################# cut out a couple of rows here as it is repeated 12 times.

###### =========== MLME-Request ============ ######
######               MLME_JOIN               ######
###### ===================================== ######
STATUS      : Duty-cycle restricted
Next Tx in  : 3507312 [ms]

###### ============ CTXS STORED ============ ######
Size        : 2208

......

The only point that helps at this point is restart at Step 1 from above. - or wait for an hour.
Are those symptoms related to the gateway or the node? I am using RAK7289CV2.
If a pro could give me a hint where to look next or some context I would be very grateful.

@smalltoe smalltoe changed the title second join always ends in rx 2 timout second join always ends in rx 2 timeout Aug 31, 2023
@smalltoe
Copy link
Author

Thinking through the topic I guess I have found the right approach and understanding:
Joining the network has to be executed only once, like in step 2. After that the node has joined and does not need to join again.
With lorawan_is_joined() I can check if the node has joined.
With a slight modification of the example like the below, I can check if the node joined already and only if that is not the case execute the procedures to join.

    if (!lorawan_is_joined()) {

        // Start the join process and wait
        printf("Joining LoRaWAN network ...");
        lorawan_join();

        while (!lorawan_is_joined()) {
            lorawan_process_timeout_ms(1000);
            printf(".");
        }
        printf(" joined successfully!\n");
    }

@smalltoe
Copy link
Author

Looks like that was not it. After batteries drained the behaviour returned.

Copy link

stale bot commented Nov 15, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 15, 2023
@sandeepmistry sandeepmistry added bug Something isn't working help wanted Extra attention is needed and removed stale labels Nov 20, 2023
@ioanfesteu
Copy link

ioanfesteu commented Nov 21, 2023

Your problem seems to have to do with the duty cycle. I see you are using EU868 where duty cycle is restricted to 1% of total airtime. Try edit the folowing line in "src/lorawan.c" file by changing true to false then try again. :

`/*!
 * LoRaWAN ETSI duty cycle control enable/disable
 *
 * \remark Please note that ETSI mandates duty cycled transmissions. Use only for test purposes
 */
#define LORAWAN_DUTYCYCLE_ON                        true`

I encountered the same problem while testing my node and I wasn't patient enaugh between joins.

@Smartich0ke
Copy link

I'm also having this same problem. Setting LORAWAN_DUTYCYCLE_ON to false didn't help and neither did the join logic by @smalltoe . In the TTN console I get the occasional MIC Mismatch error. I have double checked and triple checked the app-eui, dev-eui, and join-eui to be correct.

@Smartich0ke
Copy link

I'm still having the problem and haven't found a solution. Could anyone help with this?

@s00500
Copy link

s00500 commented Jul 3, 2024

Seems like I have exactly the same issue here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants