Request - DevMode toggle or Reset Nonce button

TLDR: I think the ability to toggle an OTAA end device into a development mode, or reset devNonce would be very beneficial.

I’m developing an end node using the Microchip WLR089U0, and am currently using the devboard. I’m using OTAA and have successfully connected and been able to transmit data.
However, each time I modify my firmware I need to rejoin to the application. This then results in devNonce “is already in use” and “is too small” errors. I have occasionally been able to get around this by changing the LoRaWAN version from MAC v1.0.4 back to 1.0.3, but that doesn’t always work. The LoRaWAN stack supplied by Microchip is v1.0.4 compatible.

In my searching I’ve come across a few recommended solutions for this, however I think that I’m missing information.

Is it possible to access the console for the au1 community console? I know what I need to change, but I just can’t figure out how to do it. Is this something that could be included as an attribute option?

Some additional links:

Currently trying to find where to ‘manually’ set the devNonce value. A search through the demo mote example project for nonce gives no indication of where it’s set. There are 3 references. 2 error messages and an output variable within secure application layer code. The comment is “If the output is encrypted, a 32 byte random nonce generated by the device is returned here. If output encryption is not used, this can be NULL.”
The search continues.

What is wrong with using ABP for development and then switching to OTAA for final testing & deployment?

PS, you would need to disable frame counter checks for ABP but they don’t affect OTAA.

@descartes You make a good point. I did some quick experiments by changing over to ABP, but couldn’t get any messages to be received by the application. The gateway was receiving them, just not getting all the way through. My initial testing using a Dragino Arduino Shield, and an LG-01 (Shh, don’t tell anyone it was on TTN) used ABP, and worked fine, once disabling the frame counter checks. It was also on v2, but that shouldn’t matter.
I’ll have another crack at ABP later. The Microchip codebase is rather large to get my head around where and when things are happening. Most things that need changing are in conf_app.h

For those following this later, the function that returns the nonce is only in the certificate version of the mote example, and I’ve been unable to find the implementation of the function. I think the default when not using the certificate is NULL, so if I can figure out where to change that, that’ll be the best solution for LoRaWAN v1.0.x. However if a change is made to v1.1, the devNonce will need to increment instead of being random.

The MLS Migration Guide mention in the MLS_SDK_1_0_P_5 (Lorawan v1.0.4) section that:
2. AppNonce and AppEUI renamed to JoinEUI and JoinNonce.
4. DevNonce incremented with every join request.
However I can’t find reference to any of those names in the example projects. It’s tricky, because this is the release that adds support for the WLR089U0 in the End device demo application. Maybe I just need to keep submitting join requests until DevNonce is unique.

That applies to 1.0.4 as well.

Or make it a counter and store the value. The value is 64K values max so it is not like it will wear out an eeprom.

DevNonces should not be re-used. @kersing’s recommendation to store the counter is the correct approach. This approach is also suggested by the LoRaWAN 1.0.4 specification:

Screen Shot 2021-04-07 at 10.01.42

For development devices (don’t do it with production devices) it is possible to disable nonce checks, just as it’s possible to disable frame counter checks for ABP development devices (again, don’t do it with production devices).

At the moment (but that may change in the future) it’s not possible to disable those checks in the Console, but if you have set up the CLI, you can try the ttn-lw-cli end-devices set command with the --resets-join-nonces flag to allow re-using DevNonces.