rssi: calculate signal and noise in firmware #240
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.