Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoRaWAN: Fixing premature RX2 closure #10196

Merged
merged 3 commits into from Mar 27, 2019

Conversation

Projects
None yet
5 participants
@hasnainvirk
Copy link
Contributor

commented Mar 22, 2019

Description

A bug while setting up RX start timers would result in premature closusre of RX2 window. The 'ack_Timeout_timer' would be invoked prematurely and
at that time RX2 window may be being demodulating. This resulted in
massive instability with any test that relied on Confirmed traffic or
lower data rates.

To fix the issue, we must know the length of the RX window in
milliseconds and for this purpose we have extended the
'get_rx_window_params(...)' API. The length of the time the window
may remain open must be accounted for while setting up
'ack_timeout_timer'.

While calculating ack timeout, we were ending up getting a random value
which may become less than 2 seconds. This is not allowed as per v1.0.2
specification.

To fix the issue we now take the random number from 0 to 2000 ms and
then add that to the fixed 2000 ms ack timeout value, guaranteeing a
value at least equal to 2000 ms.

Compliance Testing

Compliance test were run with Nucleo-476RG and SX1276. All tests passed.

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

Release Notes

hasnainvirk added some commits Mar 22, 2019

Fixing premature RX2 abort
A bug while setting up RX start timers would result in premature closusre
of RX2 window. The 'ack_Timeout_timer' would be invoked prematurely and
at that time RX2 window may be being demodulating. This resulted in
massive instability with any test that relied on Confirmed traffic or
lower data rates.

To fix the issue, we must know the length of the RX window in
milliseconds and for this purpose we have extended the
'get_rx_window_params(...)' API. The length of the time the window
may remain open must be accounted for while setting up
'ack_timeout_timer'.
Ack timeout must be at least 2 seconds
While calculating ack timeout, we were ending up getting a random value
which may become less than 2 seconds. This is not allowed as per v1.0.2
specification.

To fix the issue we now take the random number from 0 to 2000 ms and
then add that to the fixed 2000 ms ack timeout value, guaranteeing a
value at least equal to 2000 ms.
Unit test fix LoRaPHY_stub
get_rx_window_params() API is changed. To reflect that changing the
stub.
@hasnainvirk

This comment has been minimized.

Copy link
Contributor Author

commented Mar 22, 2019

@ciarmcom ciarmcom requested review from ARMmbed/mbed-os-maintainers Mar 22, 2019

@ciarmcom

This comment has been minimized.

Copy link
Member

commented Mar 22, 2019

@hasnainvirk, thank you for your changes.
@ARMmbed/mbed-os-wan @ARMmbed/mbed-os-maintainers please review.

@hasnainvirk

This comment has been minimized.

Copy link
Contributor Author

commented Mar 22, 2019

@0xc0170 Failure doesn't seem to be related to the PR.

@cmonr

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

CI started

@cmonr

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

Whoops. Started CI early, since still waiting on reviewers, but will let it go since load is low.

@mbed-ci

This comment has been minimized.

Copy link

commented Mar 26, 2019

Test run: SUCCESS

Summary: 13 of 13 test jobs passed
Build number : 1
Build artifacts

@cmonr

cmonr approved these changes Mar 26, 2019

@cmonr

This comment has been minimized.

Copy link
Contributor

commented Mar 26, 2019

LGTM.

@hasnainvirk @AnttiKauppila Marked this for 5.13, since the public function has changed.

Will merge in a bit.

cmonr added a commit to cmonr/mbed-os that referenced this pull request Mar 26, 2019

Merge pull request ARMmbed#10196 from hasnainvirk/premature_rx2_fix
LoRaWAN: Fixing premature RX2 closure

@cmonr cmonr merged commit a0a265a into ARMmbed:master Mar 27, 2019

28 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/build-ARMC5 Success
Details
jenkins-ci/build-ARMC6 Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR8 Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(+0 bytes) RAM(+0 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARMC5 Success
Details
jenkins-ci/mbed2-build-ARMC6 Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR8 Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Local astyle testing has passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/doxy-spellcheck Local doxy-spellcheck testing has passed
Details
travis-ci/events Passed, runtime is 9061 cycles (-1326 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/include_check Local include_check testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8408B (+0.00%)
Details
travis-ci/psa-autogen Local psa-autogen testing has passed
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details
travis-ci/tools-py3.5 Local tools-py3.5 testing has passed
Details
travis-ci/tools-py3.6 Local tools-py3.6 testing has passed
Details
travis-ci/tools-py3.7 Local tools-py3.7 testing has passed
Details

@cmonr cmonr removed the ready for merge label Mar 27, 2019

@hasnainvirk hasnainvirk deleted the hasnainvirk:premature_rx2_fix branch Mar 27, 2019

@AnttiKauppila

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2019

@cmonr Internal function has been modified and API is untouched. This should go to next patch release.

@cmonr

This comment has been minimized.

Copy link
Contributor

commented Mar 27, 2019

@AnttiKauppila Release label updated.

I knew that ATHandler was internal, but so is LoRaPHY? Is that because users should be expected to interface with LoRaWAN/LoRa, and not the Phy?

CC @ARMmbed/mbed-os-maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.