Skip to content

Conversation

daniel-k
Copy link
Member

This PR should fix wrong LQI values for the new driver and adds additional measures to ensure IEEE 802.15.4 compliance regarding the PHR field as suggested by the datasheet and already discussed in #2825.

ng_at86rf2xx_fb_read(dev, &phr, 1);

/* Mask MSB for 802.15.4 compliance, see
* section 37.1.1.2 of SAM R21 datahseet
Copy link
Contributor

Choose a reason for hiding this comment

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

could you please reference the radio datasheets (-> it is section 8.1.1.2 for all four supported devices...)

@OlegHahm OlegHahm added Area: network Area: Networking Area: drivers Area: Device drivers labels Apr 29, 2015
@OlegHahm OlegHahm added this to the Release NEXT MAJOR milestone Apr 29, 2015
@OlegHahm
Copy link
Member

OlegHahm commented May 5, 2015

@haukepetersen, are we all set here and ready to go?

@biboc biboc modified the milestones: Release 2015.06, Release NEXT MAJOR May 5, 2015
@daniel-k
Copy link
Member Author

daniel-k commented May 6, 2015

I would think so. Did anyone else test my changes?

@haukepetersen
Copy link
Contributor

I test this as we speek

@haukepetersen
Copy link
Contributor

Running this on the iot-lab and the samr21, I am not sure if the LQI values are correct (or actually I am not even sure what they should look like). If the LQI value should be fixed depending on the payload length, then everything works fine...

@jonas-rem
Copy link
Contributor

I tested the LQI value yesterday in conjunction with the kw2x-device and the driver of #2756. I received a value between 100 and 220 or so, depending on the rssi. When the distance between both devices was close, the value was around 220, when increasing the distance the value dropped. According to the reference manual of the kw2x-device (p.113) this behaviour is correct. The RSSI-value can be calculated from the LQI-value.

What should the RSSI-value look like in the NETIF-header? In general RSSI is the signal strength in dBm, so a value of -100 to -20 should be appropriate. Is the sign in this case just omitted?

@biboc
Copy link
Member

biboc commented May 6, 2015

On the samr21, I observe the same behaviour than @haukepetersen, LQI depends on the payload...

@haukepetersen
Copy link
Contributor

So to me it still seems to broken with this PR?

@jonas-rem
Copy link
Contributor

If the at86rf2xx does not provide a working LQI, maybe you can calculate this value. In the Freescale KW2x device it is opposite; the RSSI-value is not provided, but it can be calculated using the LQI.
RSSI = (LQI – 286.6) / 2.69333 [KW2x-Reference Manual]

Do we really need both values for the upper layer? Since they seems to be directly related to each other one of the values would be sufficient.

@daniel-k
Copy link
Member Author

daniel-k commented May 6, 2015

Do we really need both values for the upper layer? Since they seems to be directly related to each other one of the values would be sufficient.

Actually they aren't. RSSI and ED give you information about the signal power on your channel. This include of course noise and other signal sources (e.g. WLAN). LQI on the other hand is an indicator for the actual received signal quality.

The radio transceiver uses correlation results of multiple symbols within a frame to determine the LQI value. This is done for each received frame.


The received signal power as indicated by received signal strength indication (RSSI) value or energy detection (ED) value of the Atmel AT86RF233 do not characterize the signal quality and the ability to decode a signal.


Various combinations of LQI and RSSI/ED are possible for routing decisions. As a rule of thumb, information on RSSI/ED is useful in order to differentiate between links with high LQI values. However, transmission links with low LQI values should be discarded for routing decisions, even if the RSSI/ED values are high, since it is merely an information about the received signal strength, whereas the source can be an interferer.

The extracts are taken from AT86RF233 datasheet on page 110.

@haukepetersen
Copy link
Contributor

If the at86rf2xx does not provide a working LQI

Actually I think the devices do, it is just a question of reading the right value :-)

@daniel-k
Copy link
Member Author

daniel-k commented May 8, 2015

So I checked again and I can't seem to find the error. I looked at the raw framebuffer which looks good. Some header, payload, CRC and then 3 never changing bytes. I double-checked how Atmel is getting their LQI in lwMesh and they also read the first Byte after the CRC checksum as LQI.

I found out that LQI is only valid in 250kbp/s mode and when the payload is greater than 2 octets, which I checked is both met.

I observed that even if the 3 Bytes after the checksum (FCS field) seem to be static when transmitting the same payload, the last 2 Bytes (ED, RX_STATUS) change when power cycling the board. That seems kind of strange, so I suspected that it's some kind of SPI or maybe data handling error.

That's where I am now. I had a look at the SPI driver. Even though there are some strange things happening, they should have no effect on my observations.

Maybe it's some kind of harfware fault? If nobody comes up with an idea I would open a ticket at Atmel support I guess.

@biboc
Copy link
Member

biboc commented May 11, 2015

@daniel-k, you were deep in your observations so oppening a ticket is what you should do now IMO.

@haukepetersen
Copy link
Contributor

Asking Atmel about this seems the right way to go. @daniel-k, will you do that?

@daniel-k
Copy link
Member Author

Already did 2 days ago, now waiting for a response. I also linked them this issue, so let's wait.

@biboc
Copy link
Member

biboc commented May 19, 2015

@daniel-k, any answer from ATMEL?

@daniel-k
Copy link
Member Author

@bapclenet There was a reply, but no answer / solution yet. But we'll get there.

@biboc
Copy link
Member

biboc commented May 27, 2015

@daniel-k, any news then?

@daniel-k
Copy link
Member Author

@bapclenet I was quite busy the last week, but today I managed to redo my measurements and sent them to Atmel again. They advised me to try their Wireless Performance Analyzer. I'll do that soon.

Here are my finding regarding LQI values: http://docdro.id/11n0h
The boards are lying 10cm away from each other and I'm sending packets from one to the other with increasing payload size. The numbers in the sheet are frame lengths, no payload lengths, that was a mistake.

This looks really strange, doesn't it?

@biboc
Copy link
Member

biboc commented May 27, 2015

The LQI value is almost always 255 for scenarios with very low signal distortions and a signal strength much greater than the sensitivity level. In this case, the packet error rate tends towards zero and increase of the signal strength, that is by increasing the transmission power, cannot decrease the error rate any further. Received signal strength indication (RSSI) or energy detection (ED) can be used to evaluate the signal strength and the link margin.

So yes, this is definitely strange! At 10cm, it should be 255 everytime. Either the way we get LQI is wrong or there is an hardware problem. Let's see what ATMEL says about it.

@OlegHahm
Copy link
Member

Maybe 10cm are too close and cause some kind of near field effect?

@daniel-k
Copy link
Member Author

@OlegHahm I got similar results with incresed distance. And either way it would be a huge drawback in system design if this wouldn't work that way IMO.

@OlegHahm
Copy link
Member

I think it was worth a try and it's not uncommon that radios have problems at low distances due to crosstalk.

@daniel-k
Copy link
Member Author

I just went outside and arranged the boards at about 1m away from each other, turned Wifi of my notebook off. I got surprisingly low RSSI values, but the same (swinging) scheme of LQI.

@jonas-rem
Copy link
Contributor

Maybe 10cm are too close and cause some kind of near field effect?

Some weeks ago I tested this setup with two KW2x radio modems. The closer the distance between both antennas was, the higher was the LQI I received. So I could not observe some kind of near field distorion. But HF is always some kind of magic and generalization is difficult ;).

@daniel-k
Copy link
Member Author

daniel-k commented Jun 1, 2015

So Atmel wants me to flash their Performance Analyzer Software to test the board. Unfortunately I don't have access to a Windows PC at the moment and running Atmel Studio inside a VM doesn't seem to work for me (USB not recognized). Maybe someone else can try this?

They sent me these links:

@OlegHahm
Copy link
Member

OlegHahm commented Jun 1, 2015

@kaspar030, haven't you found a way to run this Atmel software inside some Windows VM?

@biboc
Copy link
Member

biboc commented Jun 28, 2015

@daniel-k, @haukepetersen, ping

@daniel-k
Copy link
Member Author

Nothing new from my side. Waiting for someone to try.

@OlegHahm OlegHahm assigned kaspar030 and unassigned haukepetersen Jun 29, 2015
@biboc
Copy link
Member

biboc commented Jun 30, 2015

Ok, I'm on it, what do you me to do with the Performance Analyzer Software? Look at LQI value?

@daniel-k
Copy link
Member Author

@bapclenet Thanks for your commitment!

I would have done their tests while watching the LQI value. See this document where I ran tests with RIOT. From there it looks like LQI is coupled somehow to frame length OR there is something going wrong badly in our driver. But I don't know. And I never used Atmel Studio either ...

@OlegHahm OlegHahm assigned biboc and unassigned kaspar030 Jun 30, 2015
@biboc
Copy link
Member

biboc commented Jun 30, 2015

@daniel-k,
I change what they call frame lenght to 64 (I think it is different from your payload) and try to move it step by step up to 75. LQI value stays at 255 (or 254,253). It is definitely not what you've got which seems to be dependent on the payload.
Tell me if you want me to run other tests, look at the parameters I can change
http://www.atmel.com/webdoc/wirelesscomposer/wc_TxProIntroSec.html

My conclusion would be that we don't get the right LQI value, sorry.

@biboc
Copy link
Member

biboc commented Jun 30, 2015

capture

@daniel-k
Copy link
Member Author

My conclusion would be that we don't get the right LQI value, sorry.

Seems so. I really don't have a clue why. How are we going to proceed? If our investigation doesn't yield success, at least we should disable the LQI for this driver.

@biboc
Copy link
Member

biboc commented Jun 30, 2015

Have had a look at Atmel examples?
(I've just sent it to you by email.)

@biboc
Copy link
Member

biboc commented Jul 3, 2015

@daniel-k ping

@@ -293,7 +293,8 @@ static void _receive_data(ng_at86rf2xx_t *dev)
/* fill missing fields in netif header */
netif = (ng_netif_hdr_t *)hdr->data;
netif->if_pid = dev->mac_pid;
ng_at86rf2xx_rx_read(dev, &(netif->lqi), 1, pkt_len);
/* LQI offset: Payload (pkt_len) + FCS (2 byte) */
ng_at86rf2xx_rx_read(dev, &(netif->lqi), 1, pkt_len + 2);
Copy link
Member

Choose a reason for hiding this comment

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

Looking at section 38.3.2 of the samr21 reference it seems there has to be one additional offset byte as PHR has offset 0. Right?
screen shot 2015-07-06 at 11 10 40

While the offset should be fine for rf231 modules.

Copy link
Member Author

Choose a reason for hiding this comment

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

In general yes, but you need to have a look at the implementation:

void ng_at86rf2xx_rx_read(ng_at86rf2xx_t *dev, uint8_t *data, size_t len,
                          size_t offset)
{
#ifndef MODULE_NG_AT86RF231
    ng_at86rf2xx_sram_read(dev, offset + 1, data, len);
#else
    ng_at86rf2xx_sram_read(dev, offset, data, len);
#endif
}

@daniel-k
Copy link
Member Author

@bapclenet
It seems like they don't use the LQI value, but normalize it or don't use it at all. There's a #ifdef RSSI_TO_LQI_MAPPING that decides which one to use.

In the case they use the LQI value, they only use the upper 2 bits and multiply this with the ED value (and something more, but constant).

I looked again in the datasheet of the RF233 with the hope to find something I missed, but nope. There are guys using the RF230 [1] that seem to get sensible LQI readings. So I more and more get the impression that something is wrong the RF chip inside the SAM-R21. At least I don't have a clue what should go wrong otherwise.

[1] http://www.avrfreaks.net/forum/lqi-reading-at86rf230

@OlegHahm
Copy link
Member

OlegHahm commented Aug 8, 2015

If your assumption is right, we should be able to get proper readings on other at86rfxx boards, e.g. the IoT-LAB_M3, right?

@kaspar030 kaspar030 modified the milestones: Release NEXT MAJOR, Release 2015.09 Sep 2, 2015
@daniel-k
Copy link
Member Author

See #3954 for fixing LQI. Masking PHR will have a separate PR.

@daniel-k daniel-k closed this Sep 24, 2015
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants