Skip to content

Instantly share code, notes, and snippets.

@lupyuen
Last active May 30, 2022 11:52
Show Gist options
  • Save lupyuen/1d96b24c6bf5164cba652d903eedb9d1 to your computer and use it in GitHub Desktop.
Save lupyuen/1d96b24c6bf5164cba652d903eedb9d1 to your computer and use it in GitHub Desktop.
LoRaWAN Join Accept Response: When will we receive it?

LoRaWAN Join Accept Response: When will we receive it?

After sending a LoRaWAN Join Request, when will we receive the Join Accept Response?

We'll receive the Join Accept Response in 5 to 6 seconds after the Join Request.

We see this in the LoRaMAC Log for PineDio USB...

MLME-Request: MLME_JOIN             
...
RadioRx: rx_timestamp-tx_timestamp=6 secs
IRQ_PREAMBLE_DETECTED! 
IRQ_HEADER_VALID! 
RXDONE! 
MLME-Confirm: JOINED

(Source)

Is this documented in the LoRaWAN Spec?

Yep, let's follow the document trail...

LoRaWAN Receive Windows

(From LoRaWAN Spec)

LoRaWAN Receive Windows

Before we go into the Join Request, let's look at the LoRaWAN Receive Windows.

What's a LoRaWAN Receive Window?

According to the LoRaWAN Spec (pic above), we should do this whenever we transmit a LoRaWAN Packet...

  • Send the LoRaWAN Packet (Frame)
  • Wait 1 second (RECEIVE_DELAY1)
  • Attempt to receive a LoRaWAN Packet for the next 1 second (RECEIVE_DELAY2 - RECEIVE_DELAY1)
  • If nothing received, attempt to receive another LoRaWAN Packet (at a different frequency)
  • Go to sleep

(RECEIVE_DELAY1 and RECEIVE_DELAY2 are defined in the LoRaWAN Regional Parameters)

Thus we have Two Windows for receiving LoRaWAN Packets. Each Receive Window is 1 second long.

(See the LoRaWAN Spec)

Join Request Windows

How are Receive Windows relevant to the LoRaWAN Join Request?

The LoRaWAN Spec says that the LoRaWAN Join Request works with Receive Windows, except that the Receive Timings are different...

  • Send the LoRaWAN Join Request
  • Wait 5 seconds (JOIN_ACCEPT_DELAY1)
  • Attempt to receive the LoRaWAN Join Accept Response for the next 1 second (JOIN_ACCEPT_DELAY2 - JOIN_ACCEPT_DELAY1)
  • Note: If the Join Request fails, the Join Accept Response will not be returned by the LoRaWAN Gateway!

(See the LoRaWAN Spec)

(JOIN_ACCEPT_DELAY1 and JOIN_ACCEPT_DELAY2 are defined in the LoRaWAN Regional Parameters)

Which means that we expect to receive the Join Accept Response in 5 to 6 seconds after sending the Join Request.

So LoRaWAN is Time Critical?

Yes! We have a Golden Window of Exactly One Second to receive the Join Accept Response.

If we miss the window, we'll never receive the Join Accept Response and we can't do any LoRaWAN IoT things.

(Unless we send another Join Request)

Missing the Join Accept Response will cause LoRaWAN Timing Issues like these...

https://codeberg.org/JF002/loramac-node/pulls/1

https://lupyuen.github.io/articles/lorawan3#lorawan-is-time-sensitive

ChirpStack Log Is Misleading

(Source)

ChirpStack Log Is Misleading

Something looks fishy. ChirpStack says that the Join Accept Response is returned within the same second as the Join Request! (Pic above)

Yep ChirpStack fooled me too! ChirpStack sends the Join Accept Response 5 seconds after receiving the Join Request.

ChirpStack Log (pic above) seems to indicate that the Join Accept Response is returned within 1 second, but that's totally misleading. Beware! 🙄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment