rssi: calculate signal and noise in firmware - #240
Open
el-han wants to merge 2 commits into
Open
Conversation
and add rssi_signal and rssi_noise to USB packets
|
This PR made me aware of an issue. YES, technically you can sum up the received power in decibel-scale. BUT it doesn't mean you are allowed to do so if you want to calculate the mean. I see this is no new bug. You won't get around the conversion to linear scale and back. lookup-tables and linear interpolation are your friend. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since the RSSI and SNR calculations sometimes deliver unreliable values, I would like to propose a new RSSI and SNR algorithm.
Until now, the firmware calculated the RSSI value as an exponential moving average. Since it has a low pass behaviour, it generates values with a strong bias to its initial value of 0 (-54 dBm). It was replaced by a fixed average over up to 40 RSSI values (typically 35 - 38 RSSI values are acquired while waiting for the DMA to fill).
Before an USB packet is transmitted, the signal and noise values are calculated:
For now I use the two reserved bytes in the USB packet header for transmitting the signal and noise values to the host.
RSSI values are stored as raw dBm values without the 54 dB offset of the CC2400 radio chip.
I have also made cb_btle() print the signal rssi value of a packet instead of its minimal rssi value, which I think was one topic of #128 .
I am a little worried about using the reserved bytes in the USB packet header. So please feel free to discuss my changes.