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: Fine tuning timing for delays and receive windows #7191

Merged
merged 5 commits into from Jun 19, 2018

Conversation

Projects
None yet
6 participants
@hasnainvirk
Contributor

hasnainvirk commented Jun 12, 2018

Description

This PR mainly focuses on making the timing behaviour for delays and receive windows a touch better.
In the previous incarnations of the code base, as nobody else was using the main event queue, we got away with the problems. But we may encounter them if the application does some expansive operations on the event queue. We now take a timestamp at the moment the tx interrupt happens after which we are supposed to indulge into delays and opening of receive windows. Then we take a diff of time passed in between the tx interrupt and our processing time and hence we tend towards more precise timing overall.

Automatic uplink was being triggered right in the reception sequence and that was causing the call stack to be really cumbersome especially in debug builds. So to counter that, we now queue a call for automatic uplink rather than directly doing an uplink.

Two new APIs are introduced in LoRaMac class (an internal class) which provide current timing and receive slot information to the controller, i.e., LoRaWANStack.

Target Release Version : 5.9.1

Pull request type

[X] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change
Adding precise timing for receive delays
RX1 and 2 delays needed to be more precise and aggregate tx time was
drifiting because of timing difference between actual tx interrupt and
our processing of that interrupt ever so slightly.

We now take a timestamp of the tx interrupt and take a time diff while
instantiating delay timers. The timestamp is then used to update the aggregate
tx time.

Two new methods are introduced in the LoRaMac class which provide current
timing and current receive slot. These functions are used by LoRaWANStack
for its processing.
@hasnainvirk

This comment has been minimized.

Contributor

hasnainvirk commented Jun 12, 2018

@0xc0170 0xc0170 requested a review from ARMmbed/mbed-os-wan Jun 12, 2018

@hasnainvirk hasnainvirk force-pushed the hasnainvirk:precise_timing branch from b7a7ceb to 8c9df0b Jun 12, 2018

@cmonr cmonr added needs: CI and removed needs: review labels Jun 13, 2018

@cmonr

This comment has been minimized.

Contributor

cmonr commented Jun 13, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Jun 13, 2018

Build : SUCCESS

Build number : 2349
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7191/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci

This comment has been minimized.

hasnainvirk added some commits Jun 11, 2018

Queuing the automatic uplink
If the automatic uplink is sent directly the call-stack becomes larger than 1K
which may cause serious problems in debug builds. Just to have a respite between
RX and TX we queue an event for the automatic uplink rather than directly undergoing
an automatic uplink.
Adding valid frequency check for RXParamSetup cmd
We must check for a valid value of a frequency being sent
by the network server.

@hasnainvirk hasnainvirk force-pushed the hasnainvirk:precise_timing branch from 8c9df0b to d335f82 Jun 14, 2018

@hasnainvirk

This comment has been minimized.

Contributor

hasnainvirk commented Jun 14, 2018

@kjbracey-arm @AnttiKauppila Please review.

@cmonr cmonr requested a review from kjbracey-arm Jun 14, 2018

@cmonr cmonr added needs: review and removed needs: CI labels Jun 14, 2018

@mbed-ci

This comment has been minimized.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Jun 19, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Jun 19, 2018

Build : SUCCESS

Build number : 2378
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/7191/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@0xc0170 0xc0170 added needs: review and removed needs: CI labels Jun 19, 2018

@hasnainvirk

This comment has been minimized.

Contributor

hasnainvirk commented Jun 19, 2018

@cmonr @kjbracey-arm Please review and merge.

@cmonr cmonr merged commit ba5b5a3 into ARMmbed:master Jun 19, 2018

14 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/astyle Passed, 921 files
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 9050 cycles (-556 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 9964B (+0.00%)
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details
@mattbrown015

This comment has been minimized.

Contributor

mattbrown015 commented on features/lorawan/lorastack/mac/LoRaMac.cpp in 828815c Jun 26, 2018

This generates a warning if the trace level means it is included.

Should either be %lu or %" PRIu32.

I've taken to using the format macro constants in my own code but you're probably going to say that you can't because they don't exist on all currently supported compilers and language standards, I'm building with GCC ARM.

This comment has been minimized.

Contributor

hasnainvirk replied Jun 26, 2018

True. %lu should work on all platforms. Will test it.

This comment has been minimized.

Member

0xc0170 replied Jul 3, 2018

@hasnainvirk all good with this warning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment