aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2015-06-08 22:46:38 -0400
committerTom Tsou <tom.tsou@ettus.com>2015-07-30 14:19:32 -0700
commit2b542100a0493831a3dad4414f6736d7af23256c (patch)
treeb54e2de3be8562ed145c7dbc507031683141562c /Transceiver52M
parent2268c8558c38de6996a68b5cb5e1bad2dd54b26f (diff)
Transceiver: Update noise level only when the timeslot is marked as IDLE.
We can't rely on an assumption that if we can't decode a burst - it's noise. There are many rasons why we can't decode a burst even if it's well above the noise level. Just one example is a RACH burst which can be overlapped with another RACH burst up to a level both are completely unrecognizable. Another example is when a burst is destroyed by bad multi-path. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
Diffstat (limited to 'Transceiver52M')
-rw-r--r--Transceiver52M/Transceiver.cpp46
-rw-r--r--Transceiver52M/Transceiver.h2
2 files changed, 32 insertions, 16 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 0156580..8ae35f3 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -620,7 +620,7 @@ SoftVector *Transceiver::demodulate(TransceiverState *state,
* Pull bursts from the FIFO and handle according to the slot
* and burst correlation type. Equalzation is currently disabled.
*/
-SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI,
+SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI, bool &isRssiValid,
double &timingOffset, double &noise,
size_t chan)
{
@@ -632,6 +632,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI,
signalVector *burst;
SoftVector *bits = NULL;
TransceiverState *state = &mStates[chan];
+ isRssiValid = false;
/* Blocking FIFO read */
radioVector *radio_burst = mReceiveFIFO[chan]->read();
@@ -642,7 +643,9 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI,
GSM::Time time = radio_burst->getTime();
CorrType type = expectedCorrType(time, chan);
- if ((type == OFF) || (type == IDLE)) {
+ /* No processing if the timeslot is off.
+ * Not even power level or noise calculation. */
+ if (type == OFF) {
delete radio_burst;
return NULL;
}
@@ -666,7 +669,25 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI,
/* Average noise on diversity paths and update global levels */
burst = radio_burst->getVector(max_i);
avg = sqrt(avg / radio_burst->chans());
- state->mNoiseLev = state->mNoises.avg();
+
+ wTime = time;
+ RSSI = 20.0 * log10(rxFullScale / avg);
+
+ /* RSSI estimation are valid */
+ isRssiValid = true;
+
+ if (type == IDLE) {
+ /* Update noise levels */
+ state->mNoises.insert(avg);
+ state->mNoiseLev = state->mNoises.avg();
+ noise = 20.0 * log10(rxFullScale / state->mNoiseLev);
+
+ delete radio_burst;
+ return NULL;
+ } else {
+ /* Do not update noise levels */
+ noise = 20.0 * log10(rxFullScale / state->mNoiseLev);
+ }
/* Detect normal or RACH bursts */
if (type == TSC)
@@ -674,13 +695,11 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI,
else
success = detectRACH(state, *burst, amp, toa);
- /* Update noise average if no bust detected or alert on error */
+ /* Alert an error and exit */
if (success <= 0) {
- if (success == SIGERR_NONE) {
- state->mNoises.insert(avg);
- } else if (success == -SIGERR_CLIP) {
+ if (success == -SIGERR_CLIP) {
LOG(WARNING) << "Clipping detected on received RACH or Normal Burst";
- } else {
+ } else if (success != SIGERR_NONE) {
LOG(WARNING) << "Unhandled RACH or Normal Burst detection error";
}
@@ -688,19 +707,15 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, double &RSSI,
return NULL;
}
+ timingOffset = toa / mSPSRx;
+
/* Demodulate and set output info */
if (equalize && (type != TSC))
equalize = false;
bits = demodulate(state, *burst, amp, toa, time.TN(), equalize);
- wTime = time;
- RSSI = 20.0 * log10(rxFullScale / avg);
- timingOffset = toa / mSPSRx;
- noise = 20.0 * log10(rxFullScale / state->mNoiseLev);
-
delete radio_burst;
-
return bits;
}
@@ -905,8 +920,9 @@ void Transceiver::driveReceiveFIFO(size_t chan)
int TOAint; // in 1/256 symbols
double noise; // noise level in dBFS
GSM::Time burstTime;
+ bool isRssiValid; // are RSSI, noise and burstTime valid
- rxBurst = pullRadioVector(burstTime, RSSI, TOA, noise, chan);
+ rxBurst = pullRadioVector(burstTime, RSSI, isRssiValid, TOA, noise, chan);
if (rxBurst) {
dBm = RSSI+rssiOffset;
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index a7b04ed..45d3980 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -195,7 +195,7 @@ private:
void pushRadioVector(GSM::Time &nowTime);
/** Pull and demodulate a burst from the receive FIFO */
- SoftVector *pullRadioVector(GSM::Time &wTime, double &RSSI,
+ SoftVector *pullRadioVector(GSM::Time &wTime, double &RSSI, bool &isRssiValid,
double &timingOffset, double &noise,
size_t chan = 0);