Giter Site home page Giter Site logo

OTAA join about lora_device_lib HOT 5 CLOSED

cjhdev avatar cjhdev commented on June 30, 2024
OTAA join

from lora_device_lib.

Comments (5)

cjhdev avatar cjhdev commented on June 30, 2024

Hi dzurikmiroslav

I just tried master on my avr demo board to see if I've broken anything lately. I've been resetting the node to see if I can get the join to fail but for me it works correctly nearly every time.

I managed to reproduce your problem once but wasn't able to collect the frame log, and now it continues to work perfectly.

I suspect there might be some edge case where the cached join request message is clobbered. I want to confirm that the exact same join accept message gets sent on each retry. Can you see the gateway traffic log?

If you don't have access, don't worry, I'll set something up on my simulator but it might take me a few days.

edit:

I've reproduced it again. It looks like a repeating dev nonce (which can happen in LoRaWAN 1.0) but I swear I saw TTN send a join accept, which it shouldn't.

The repeating frames are identical, which rules out clobbering.

Can you confirm that your dev nonce is different when you reset the device?
With the LDL_DISABLE_POINTONE option, dev nonce should be randomised on each new join request (i.e. after you reset the device).

from lora_device_lib.

dzurikmiroslav avatar dzurikmiroslav commented on June 30, 2024

I were try instead of ESP-IDF use Arduino framework, and code start working normally. Problem were that in LDL_Chip_write and LDL_Chip_read I used spi_device_transmit, which make SPI transaction. Arduino SPI.transfer not make new transaction...

from lora_device_lib.

dzurikmiroslav avatar dzurikmiroslav commented on June 30, 2024

After more testing, I reached the problem is when first join attempt is unsuccessful (maybe signal strength problem etc...). When first join attempt is successful, node start sending data.

I modify handler function:

        case LDL_MAC_TX_BEGIN:
            ESP_LOGI(TAG, "LDL_MAC_TX_BEGIN devNonce=%d", mac.devNonce);
            break;

Log from successful join:

I (94) main: Starting...
1229: LDL_MAC_addChannel: debug: adding chIndex=0 freq=868100000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=1 freq=868300000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=2 freq=868500000 minRate=0 maxRate=5
I (94) main: LDL_MAC_RESET
I (94) main: LDL_MAC_STARTUP
I (59994) main: LDL_MAC_ready
I (59994) main: LDL_MAC_otaa
216: LDL_MAC_otaa: debug: sending join in 23758066 ticks
I (83694) main: LDL_MAC_TX_BEGIN devNonce=23989
I (83794) main: LDL_MAC_TX_COMPLETE
I (88694) main: LDL_MAC_RX1_SLOT
I (88794) main: LDL_MAC_DOWNSTREAM
1229: LDL_MAC_addChannel: debug: adding chIndex=0 freq=868100000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=1 freq=868300000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=2 freq=868500000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=3 freq=867100000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=4 freq=867300000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=5 freq=867500000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=6 freq=867700000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=7 freq=867900000 minRate=0 maxRate=5
I (88894) main: LDL_MAC_JOIN_COMPLETE
I (89494) main: LDL_MAC_ready
I (89494) main: LDL_MAC_unconfirmedData
I (89494) main: LDL_MAC_TX_BEGIN devNonce=23990
I (89494) main: LDL_MAC_TX_COMPLETE
I (90494) main: LDL_MAC_RX1_SLOT
I (91494) main: LDL_MAC_RX2_SLOT
I (91894) main: LDL_MAC_DATA_COMPLETE

Log from unsuccessful join:

I (94) main: Starting...
1229: LDL_MAC_addChannel: debug: adding chIndex=0 freq=868100000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=1 freq=868300000 minRate=0 maxRate=5
1229: LDL_MAC_addChannel: debug: adding chIndex=2 freq=868500000 minRate=0 maxRate=5
I (94) main: LDL_MAC_RESET
I (94) main: LDL_MAC_STARTUP
I (59994) main: LDL_MAC_ready
I (59994) main: LDL_MAC_otaa
216: LDL_MAC_otaa: debug: sending join in 39518844 ticks
I (99494) main: LDL_MAC_TX_BEGIN devNonce=12023
I (99494) main: LDL_MAC_TX_COMPLETE
I (104494) main: LDL_MAC_RX1_SLOT
I (105494) main: LDL_MAC_RX2_SLOT
I (106194) main: LDL_MAC_JOIN_TIMEOUT
950: LDL_MAC_process: debug: dither retry by 17082309 ticks
I (129394) main: LDL_MAC_TX_BEGIN devNonce=12023
I (129494) main: LDL_MAC_TX_COMPLETE
I (134494) main: LDL_MAC_RX1_SLOT
I (135494) main: LDL_MAC_RX2_SLOT
I (136494) main: LDL_MAC_JOIN_TIMEOUT
950: LDL_MAC_process: debug: dither retry by 27441593 ticks
I (174694) main: LDL_MAC_TX_BEGIN devNonce=12023
I (174894) main: LDL_MAC_TX_COMPLETE
I (179894) main: LDL_MAC_RX1_SLOT
I (180894) main: LDL_MAC_RX2_SLOT
I (181794) main: LDL_MAC_JOIN_TIMEOUT
950: LDL_MAC_process: debug: dither retry by 29505280 ticks
I (229794) main: LDL_MAC_TX_BEGIN devNonce=12023
I (230094) main: LDL_MAC_TX_COMPLETE
I (235094) main: LDL_MAC_RX1_SLOT
I (236094) main: LDL_MAC_RX2_SLOT
I (236994) main: LDL_MAC_JOIN_TIMEOUT

After restart devNonce is randomly generated, but after unsuccessful join request still same. Maybe problem ist that the devNonce is randomly generated in LDL_MAC_otaa, but
LDL_MAC_otaa is called once...

from lora_device_lib.

cjhdev avatar cjhdev commented on June 30, 2024

Yes, the dev nonce only changes when you initiate otaa, not on a retry.

TTN (the community service at least) will drop a dev nonce that it has seen before and the node will keep sending retries for ever. That's what it looks like when it happens to me.

The 1.0 spec says to use a random dev nonce but collisions happen since it's a 16 bit number. You can ensure this doesn't happen by not defining LDL_DISABLE_POINTONE and allowing LDL to operate in 1.1 mode (which is backwards compatible to 1.0). The downside of this mode is that you will need to save/restore dev nonce or else you run into the same problem.

Long story short, the random dev nonce is good for experiments since you can just reset to clear the block, but 1.1 is superior for nodes you put in the field.

from lora_device_lib.

cjhdev avatar cjhdev commented on June 30, 2024

I'm closing this issue since it seems to be dead.

I wasn't able to reproduce the join timeout, it may have been timing related. The devNonce will not change until OTAA succeeds.

from lora_device_lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.