How often should a node do an OTAA Join, and is OTAA better than ABP?

Quite late, but just for future reference:

Indeed, I’ve also seen that this is required for a Libelium device back in May 2016, which identified as RN2483 1.0.1 Dec 15 2015 09:38:09. And here’s the part that is relevant from that link, October 2016, numbered and formatted for readability:

The initial RN2483 and RN2903 both contained an errata meaning that the sleep current is above spec, and this can be an issue for sleepy devices trying to achieve very long battery life. As hinted in the post above, there is a work-around for this which allows Vdd to be completely removed, but then for the module to continue after Vdd is re-applied. Using OTAA to rejoin would cause a lot of over-the-air communication and so could negate any current benefit of removing Vdd in the first place.

The solution is to store all the radio state before sleeping, including the session keys, using the “mac save” command and then to continue the session after waking using the “mac join abp” command, with no over-the-air comms needed. To the network this is invisible and no different from the module sleeping instead of being turned off.

In the RN2483 example below, > indicates a command to the modem and < indicates a response from the modem:

  1. OPTIONAL - resets the module firmware to default values

    > sys reset
    < RN2483 1.0.1 Dec 15 2015 09:38:09

  2. OPTIONAL - resets the module firmware to default values, plus clears the EEPROM (session keys, EUIs etc)

    > sys factoryRESET
    < RN2483 1.0.1 Dec 15 2015 09:38:09

  3. OPTIONAL - reads the IEEE EUI of the module. Can be useful for node serialisation

    > sys get hweui
    < 0123456789ABCDEF

  4. MANDATORY - in this example the hweui value (read above) is used to uniquely serialise the deveui

    > mac set deveui 0123456789ABCDEF
    < ok

  5. MANDATORY - unique per web app. Used to route data

    > mac set appeui 0123456789ABCDEF
    < ok

  6. MANDATORY - unique per device & must match server

    > mac set appkey 0123456789ABCDEF0123456789ABCDEF
    < ok

  7. MANDATORY - create blank ABP credentials in preparation for ABP re-join. These blank credentials will be overwritten with server assigned values during the successful OTAA join accept process

    > mac set devaddr 00000000
    < ok
    > mac set nwkskey 00000000000000000000000000000000
    < ok
    > mac set appskey 00000000000000000000000000000000
    < ok

  8. OPTIONAL - default value is 34. Some private networks use 12

    > mac set sync 34
    < ok

  9. OPTIONAL - default is off, but ADR is healthy for battery life & capacity if supported by the network

    > mac set adr on
    < ok

  10. OPTIONAL - saves all the settings to EEPROM for future use

    > mac save
    < ok

  11. MANDATORY - starts the join request/accept negotiation process, over the air

    > mac join otaa
    < ok
    < accepted (or denied)

    NOTE - accepted/denied response is useful to validate network coverage & set up

  12. DEFAULT - tx an unconfirmed packet on port 1. “Hello World!”

    > mac tx uncnf 1 48656c6c6f20576f726c6421
    < ok
    < mac_tx_ok

  13. MANDATORY - “mac save” used here to store all radio state, inc counters, devaddr & nwks/apps session keys to EEPROM

    Note: “mac save” command is writing to EEPROM which is a slow process. Wait for “ok” response to confirm completion

    > mac save
    < ok

  14. REMOVE VDD AND POWER DOWN INDEFINITELY

  15. MANDATORY - prepares the LoRaWAN mac with the radio state previous stored using “mac save”. No server intervention needed

    > mac join abp
    < ok
    < accepted

  16. DEFAULT - transmit an unconfirmed packet on port 1. “Hello World!”

    > mac tx uncnf 1 48656c6c6f20576f726c6421
    < ok
    < mac_tx_ok

In both the initial session and the follow-on session the same network credentials are used and the radio state (data rates, counters etc) remain in sync, so the network server can not distinguish between this and a continuous session.

For more recent RN2xx3 devices, maybe removing the full power is no longer needed to achieve good battery life, and a regular sleep (if that exists…?) without the need for the mac join abp trickery suffices?