Skip to content

Conversation

daniel-k
Copy link
Member

I finally fixed the LQI reading for the at86rf2xx driver, as I already attempted in #2884. The problem was that LQI can only be accessed by a framebuffer read access, not by SRAM read. Therefore the whole packet needs to be read at once, so I needed to rework the receive function a bit.

@daniel-k daniel-k added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking Area: drivers Area: Device drivers labels Sep 24, 2015
@OlegHahm
Copy link
Member

Hooray!

@haukepetersen
Copy link
Contributor

Nice to see one more problem with the atrf driver solved!

Though I am not sure, if I completely like the actual solution: allocating a full packet on the stack could be potential dangerous. When rewriting the driver, one of the main ideas was to get rid of this additional layer of buffering. Now it seems that this is not possible when wanting to use LQI values I guess we can not prevent this. So instead of allocating this temporary buffer on the stack, I think I would tend to allocate it statically as part of the device descriptor. This could also simplify the rest of the receive function code a bit...

@daniel-k
Copy link
Member Author

So instead of allocating this temporary buffer on the stack, I think I would tend to allocate it statically as part of the device descriptor.

Sure. This was the easiest approach to be honest. Would you take over this part @haukepetersen?

@DipSwitch
Copy link
Member

This would also fix RSSI readout? In my setup I see that the RSSI is read
out properly in the netif thread, but when the message receives the calling
thread the value is cleared.

Just curious :)
On 24 Sep 2015 16:45, "Daniel Krebs" notifications@github.com wrote:

So instead of allocating this temporary buffer on the stack, I think I
would tend to allocate it statically as part of the device descriptor.

Sure. This was the easiest approach to be honest. Would you take over this
part @haukepetersen https://github.com/haukepetersen?


Reply to this email directly or view it on GitHub
#3954 (comment).

@daniel-k
Copy link
Member Author

This would also fix RSSI readout? In my setup I see that the RSSI is read out properly in the netif thread, but when the message receives the calling thread the value is cleared.

I don't think so. RSSI readout doesn't really change with this PR. Do you use RSSI for something? AFAIK there's no documentation in RIOT what netif->rssi and netif->lqi really mean apart from the bigger the better. This driver only stores the raw uint8_t rssi value, although it translates to -94 + rssi [dBm] IIRC.

@DipSwitch
Copy link
Member

Thanks for the reply, but that was a different problem :)

@OlegHahm
Copy link
Member

AFAIK there's no documentation in RIOT what netif->rssi and netif->lqi really mean apart from the bigger the better.

Btw that's the same for Linux for one simple reason: at least RSSI is vendor specific. Some vendors assign RSSI values between 0 and 3 while other uses the full width of the data type.

@biboc
Copy link
Member

biboc commented Sep 26, 2015

Good job @daniel-k ! Hopefully LQI and RSSI will be useful one day with RPL ;-)
I will test this PR on Monday and we will merge the PR as soon as the release is over.

So instead of allocating this temporary buffer on the stack, I think I would tend to allocate it statically as part of the device descriptor.
I would just add that we should consider which one of the solution take more space at compilation since we're working with constrained device. I don't know the answer but someone here may know.

@OlegHahm OlegHahm added this to the Release NEXT MAJOR milestone Sep 26, 2015
@thomaseichinger
Copy link
Member

In the current approach we the only read access out of frame buffer sequence is the LQI read access. Maybe we could change the current approach to something using fb access like

at86rf2xx_fb_read_start(dev); /* CS, SPI acquire and send SPI FB access */
...
at86rf2xx_fb_read(dev, mhr, 2); /* read FCS */
hdr_len = _get_frame_hdr_len(mhr);
at86rf2xx_fb_read(dev, &(mhr[2]), hdr_len - 2); /* read addresses and the like */
...
payload = gnrc_pktbuf_add(hdr, NULL, (pkt_len - hdr_len), dev->proto);
at86rf2xx_fb_read(dev, payload->data, payload->size); /* dump payload in pkt buffer snip */
...
at86rf2xx_fb_read(dev, &(netif->lqi), 1);
at86rf2xx_fb_read_stop(dev); /* chip unselect, SPI release */
dev->event_cb(NETDEV_EVENT_RX_COMPLETE, payload);

@biboc
Copy link
Member

biboc commented Sep 30, 2015

@thomaseichinger, ok, your approach seems a bit cleaner, I don't have a strong opinion on which way to go since the result is going to be the same

@daniel-k daniel-k force-pushed the pr/at86rf2xx_fix_lqi branch from 205b853 to 2d1973f Compare September 30, 2015 16:01
@daniel-k
Copy link
Member Author

I really liked @thomaseichinger proposal. It seems to work and it should be quite easy to review now because code-wise not much has changed.

@biboc
Copy link
Member

biboc commented Oct 6, 2015

I tested it, I got lot of 255 values and some below. Seems to work but how may I really tell that it works.

The IEEE 802.15.4 standard defines the LQI as a characterization of the strength
and/or quality of a received frame. The use of the LQI result by the network or
application layer is not specified in this standard. The LQI value shall be an integer
ranging from zero to 255, with at least eight unique values. The minimum and maximum
LQI values (0x00 and 0xFF) should be associated with the lowest and highest quality
compliant signals, respectively, and LQI values in between should be uniformly
distributed between these two limits.

How may I make the signal quality worse? Otherwise I ACK this PR and I'll merge it.

@biboc biboc added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Oct 6, 2015
@daniel-k
Copy link
Member Author

daniel-k commented Oct 6, 2015

@bapclenet
From my observations the LQI will be quite stable at 255 as long as RSSI (raw) is > 0. Increase distance/walls between your boards and try again.

@daniel-k
Copy link
Member Author

daniel-k commented Oct 9, 2015

@haukepetersen You okay with the current implementation?


at86rf2xx_fb_read(dev, &(netif->lqi), 1);

#ifndef MODULE_AT86RF231
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked for the 212b as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I have 😄 Yes, it has ED value after LQI, so it's fine. See p.133

@biboc
Copy link
Member

biboc commented Oct 16, 2015

Great let's merged, will come back if we find any problem concerning LQI value if @haukepetersen agrees on the new implementation?

@biboc
Copy link
Member

biboc commented Oct 26, 2015

ping @haukepetersen

2 similar comments
@miri64
Copy link
Member

miri64 commented Nov 27, 2015

ping @haukepetersen

@biboc
Copy link
Member

biboc commented Dec 7, 2015

ping @haukepetersen

@haukepetersen
Copy link
Contributor

Sorry for the sleepiness on my side... I am good with this change - though I have no time to test today. But @bapclenet, if you ack still holds, I say lets merge this!

@thomaseichinger
Copy link
Member

NACK for now, doesn't work for iotlab-m3.

@daniel-k
Copy link
Member Author

daniel-k commented Dec 8, 2015

Damn! Deadline for my thesis is next tuesday so I won't be able to fix this until then 👿 Whats the release deadline for 2015.12 again?

@thomaseichinger
Copy link
Member

Feature freeze is today, I'm investigating.

@thomaseichinger
Copy link
Member

Ok, found the problem. Please see daniel-k#4.

@thomaseichinger
Copy link
Member

@daniel-k Please squash.

@thomaseichinger
Copy link
Member

ACK when squashed and Travis passed.

@daniel-k daniel-k force-pushed the pr/at86rf2xx_fix_lqi branch from 171b5db to a643789 Compare December 8, 2015 13:47
@daniel-k
Copy link
Member Author

daniel-k commented Dec 8, 2015

@thomaseichinger
Squashed. Now waiting for travis.

@daniel-k
Copy link
Member Author

daniel-k commented Dec 8, 2015

@thomaseichinger
Any idea why avr and arm7 are failing right away?

@thomaseichinger
Copy link
Member

thomaseichinger commented Dec 8, 2015 via email

@daniel-k
Copy link
Member Author

daniel-k commented Dec 8, 2015

Woohoo, Travis is happy. Finally this PR can be merged :)

daniel-k added a commit that referenced this pull request Dec 8, 2015
@daniel-k daniel-k merged commit bb4fe8d into RIOT-OS:master Dec 8, 2015
@thomaseichinger
Copy link
Member

\o/

@biboc
Copy link
Member

biboc commented Dec 8, 2015

Great! Thanks

@OlegHahm
Copy link
Member

OlegHahm commented Dec 8, 2015

Cool! Nice job everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants