Lora-net / SWL2001

LoRa Basics Modem LoRaWAN stack
BSD 3-Clause Clear License
87 stars 50 forks source link

Many successive JOINFAIL attempts #42

Closed bdesterBE closed 1 month ago

bdesterBE commented 4 months ago

Hello,

I have recently completed a board port for SWL2001 to work on ESP32-S3 with the Semtech SX1262. I can successfully join with my LNS (AWS), but only typically after several failed JOINFAIL events occurring first. Occasionally, it will join successfully on the first attempt. I have also noticed that I must set RP_MARGIN_DELAY to a value around 5000ms for it to ever join successfully. When I enable MODEM_HAL_DBG_TRACE_RP, I notice that I always get the print that the high priority task (the join request) is in the future, and a delay amount of around 4800ms. I have verified that the LNS is configured for the correct MAC version (1.0.4), and the correct regional parameters version. I have tried configuring both RP2_101 and RP2_103 on the SWL2001 side, with the corresponding correct RP version on AWS, as well as using MAC version 1.0.3 with similarly matching configurations on AWS, but have yet to have a successful combination with consistent results.

Is it the case that this is just the reality and behavior of LoRaWAN? Or should join attempts and RX window 1 and 2 openings be more accurate and consistent than this? Any help is appreciated.

Thanks. Brandon

UPDATE: I found this document and followed the section 8, RX Window Debugging procedure. I am now using a board delay of 1ms (the same as it was previously), and an RP margin delay of 234ms - far less than the previously mentioned 5000ms delay I was using.

I am able to join with this timing, but it still seems to take more JOINFAIL events than I had hoped for.

bdesterBE commented 4 months ago

@lbm-team Bump. Hoping to get a little guidance or suggestions for reducing JOINFAILs.

lbm-team commented 4 months ago

Hello bdesterBE,

Have you read the porting guide first:
https://github.com/Lora-net/SWL2001/blob/master/lbm_lib/PORTING_GUIDE.md

and have you tried running the porting tool:
https://github.com/Lora-net/SWL2001/blob/master/lbm_examples/main_examples/main_porting_tests.c

Best

bdesterBE commented 4 months ago

Hi lbm-team,

Thank you for your response. Yes, I followed the porting guide and have run the porting tests. All tests are now passing (explanation ahead).

I realized that the reason for the need to increase the RP margin delay was a delay I added in the busy line wait loop. The intent was to avoid hogging processor time with a busy wait, as there are other peripherals and threads in my use-case. Re-running the RX debugging procedure with the delay removed shows that timing is now correct (both delays were exactly 5000ms) without any margin delay adjustment. The result from the related porting test also no longer indicates that RX and TX configuration times are too long as it did prior to the change.

This being said, I still observe more join failures than I would expect. With the RP margin delay now fixed, I have entirely run out of ideas as to what the problem could be, other than possibly the issue stemming from my gateway.

main_porting_tests_output.txt

opeyrard commented 1 month ago

Is this issue still valid ? Many thanks.

brandester32 commented 1 month ago

The issue has yet to be resolved, but yes can be closed. Thanks.