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

The "Margin" field of the "DevStatusAns" command payload is wrongly encoded #130

Closed
frazar opened this issue Sep 24, 2018 · 3 comments
Closed
Assignees
Labels

Comments

@frazar
Copy link

frazar commented Sep 24, 2018

Tested with Arudino Mega 2560 connected to RFM95 module.

Add the following two lines to project_config/lmic_project_config.h:

#define LMIC_DEBUG_LEVEL 2
#define LMIC_PRINTF_TO Serial

After running a slightly modified version of the ttn-otaa sketch, this is the output on the Serial.

Serial connection enstablished.
RXMODE_RSSI
62657: engineUpdate, opmode=0x808
Packet queued
62708: EV_JOINING
62778: engineUpdate, opmode=0xc
273627: engineUpdate, opmode=0xc
273909: EV_TXSTART
273934: engineUpdate, opmode=0x88c
273992: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0
582073: setupRx1 txrxFlags 00 --> 01
start single rx: now-rxtime: 6
582161: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
593337: EV_JOINED
netid: 0
devaddr: XXXXXXXX
artKey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
nwkKey: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
593699: engineUpdate, opmode=0x808
594248: EV_TXSTART
594274: engineUpdate, opmode=0x888
594393: TXMODE, freq=868100000, len=19, SF=7, BW=125, CR=4/5, IH=0
653595: setupRx1 txrxFlags 0x1 --> 01
start single rx: now-rxtime: 4294967238
653657: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
662938: process options (olen=0x6)
662975: LinkAdrReq: p1:52 chmap:0007 chpage:00 uprt:01 ans:87
663116: decodeFrame txrxFlags 0x1 --> 21
663333: Received downlink, window=RX1, port=-1, ack=0, txrxFlags=0x21
663705: EV_TXCOMPLETE (includes waiting for RX windows)
664010: engineUpdate, opmode=0x800
1289010: engineUpdate, opmode=0x808
1289466: EV_TXSTART
1289495: engineUpdate, opmode=0x888
1289554: TXMODE, freq=868300000, len=24, SF=7, BW=125, CR=4/5, IH=0
Packet queued
1349396: setupRx1 txrxFlags 0x21 --> 01
start single rx: now-rxtime: 4294967238
1349463: RXMODE_SINGLE, freq=868300000, SF=7, BW=125, CR=4/5, IH=0

Basically we can see that the Node is able to join the Lora network (593337: EV_JOINED), but fails to send the first uplink packet and keeps retrying.

Logging on the AWG ubuntu machine and checking the logs with journalctl -f -u loraserver I noticed the following lines appearing right after the node sends the "Packet queued" message:

Sep 24 20:20:15 ip-172-31-45-153 loraserver[18826]: time="2018-09-24T20:20:15Z" level=error msg="processing uplink frame error" data_base64=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX error="create uplink frame-log error: marshal phypayload error: lorawan: max value of Margin is 31"
@frazar frazar changed the title node hangs after "Packet queued" message Node hangs after "Packet queued" message Sep 24, 2018
@terrillmoore
Copy link
Member

I take it that this is not "The Things Network" as the network server? Definitely agree that this is a problem, but I need more context, as I've not seen this in my testing. (Need to figure out what additional test coverage is needed.)

@terrillmoore terrillmoore self-assigned this Sep 24, 2018
@frazar
Copy link
Author

frazar commented Sep 25, 2018

Yes, sorry for not being clear enough. I'm using the LoRa Server software stack in a development environment.

@terrillmoore
Copy link
Member

OK, cool! Another test case.... Interesting to think about how one could do hardware-in-the-loop testing with this.

You will probably find that this version of the LMIC stack doesn't do a great job with MAC command responses. See issue #87 for details. TL;DR: it doesn't built the response as it's parsing the request, so things can go back out of order (or not at all).

@frazar frazar changed the title Node hangs after "Packet queued" message Fix coding of the "Margin" field in DevStatusAns payload Sep 26, 2018
@frazar frazar changed the title Fix coding of the "Margin" field in DevStatusAns payload Node hangs after "Packet queued" message Sep 26, 2018
@frazar frazar changed the title Node hangs after "Packet queued" message The "Margin" field of the "DevStatusAns" command payload is wrongly encoded Sep 26, 2018
terrillmoore added a commit that referenced this issue Sep 27, 2018
Fix #130: Fix coding of the "Margin" field of the "DevStatusAns" MAC command payload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants