drivers/radios Apply register to rssi dBm conversion to all radios#6895
drivers/radios Apply register to rssi dBm conversion to all radios#6895miri64 merged 6 commits intoRIOT-OS:masterfrom
Conversation
|
@Hyungsin I've got no problem with that, but I'd like some kind of GO from somebody higher up in the hierarchy before I'm going to change and check most of the radio drivers |
|
@thomaseichinger, any feedback? |
drivers/at86rf2xx/at86rf2xx_netdev.c
Outdated
| radio_info->rssi = at86rf2xx_reg_read(dev, AT86RF2XX_REG__PHY_ED_LEVEL); | ||
| rssi = at86rf2xx_reg_read(dev, AT86RF2XX_REG__PHY_ED_LEVEL); | ||
| #endif | ||
| radio_info->rssi = -RSSI_BASE_VAL - rssi; |
There was a problem hiding this comment.
@bergzand Please help me out, what is the reason for changing the algebraic sign of this calculation? Especially as you are changing .rssi to int8_t ...
There was a problem hiding this comment.
I forgot to change .rssi back to the original uint8_t. The sign here is flipped to have the value from the datasheet directly as a define. The sign is flipped to correct the algabraic formula from sec 8.5.3 from the datasheet of the at86rf233 to get a positive value.
| * @{ | ||
| */ | ||
| #define CC2420_CRCCOR_CRC_MASK (0x80) | ||
| #define CC2420_CRCCOR_COR_MASK (0x7F) |
drivers/cc2420/cc2420.c
Outdated
| /* fetch and check if CRC_OK bit (MSB) is set */ | ||
| cc2420_fifo_read(dev, &crc_corr, 1); | ||
| if (!(crc_corr & 0x80)) { | ||
| if (!(crc_corr & CC2420_CRCCOR_CRC_MASK)) { |
There was a problem hiding this comment.
Think this and related changes should go in a separate commit.
|
@thomaseichinger Thank you for your feedback. I initially build the implementation here to have rssi as a |
|
The main discussion point now is whether to use |
318200b to
49b89ce
Compare
|
Great, then I make sure to adjust and clean up this PR. Is it okay to keep it one big PR for all radio drivers or do you prefer separate PR's for each radio? |
|
I think one PR is fine but maybe split changes in one commit per device. |
28a0279 to
e4a5939
Compare
|
@thomaseichinger I rebased it a bit, it is now a set of commits, one for the |
|
Awesome! Finally, could you add a mention in the header comment that rssi has to be in dBm? |
a6af6f4 to
4970660
Compare
|
Of course. |
|
@gvz If you have time, could you please test this PR with the cc2420? I don't have access to that radio, so my code is a best guess on the information from the datasheet. |
|
@bergzand Just tried on the cc2420 and the rssi is 65470, I guess something went wrong. I will try to have a look. |
|
@gvz That looks like an interpretation error, |
|
Ok I found it: its in: gnrc_netif_hdr_print.c the fix is: |
|
Got it, thanks, will put a fixup asap here. |
|
@gvz It should print negative numbers now :) |
smlng
left a comment
There was a problem hiding this comment.
tested with samr21-xpro and pba-d-01-kw2x, looks good. Though the drivers derive RSSI and LQI value differently.
|
please squash |
444f67c to
2d491e0
Compare
|
Squashed |
tests: fix tests/gnrc_netif for changes in #6895
Implementation idea of #6887. Should be easy to convert to absolute positive values if preferred.