Transceiver52M: Add clipping detection on RACH input

Alert user of overdriven RACH input indicated by a positive
threshold detector result. This indication serves as notification
that the receive RF gain level is too high for the configured
transceiver setup.

Signed-off-by: Tom Tsou <tom@tsou.cc>
This commit is contained in:
Tom Tsou
2014-12-18 15:26:57 -08:00
committed by Michael Iedema
parent b03be9567a
commit 6edb20c605
3 changed files with 43 additions and 7 deletions

View File

@@ -332,7 +332,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
int &timingOffset)
{
bool needDFE = false;
bool success = false;
int success = 0;
complex amplitude = 0.0;
float TOA = 0.0, avg = 0.0;
@@ -404,10 +404,21 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime,
}
else {
// RACH burst
if (success = detectRACHBurst(*vectorBurst, 6.0, mSPSRx, &amplitude, &TOA))
success = detectRACHBurst(*vectorBurst, 6.0, mSPSRx, &amplitude, &TOA);
if (success > 0) {
channelResponse[timeslot] = NULL;
else
} else if (success == 0) {
mNoises.insert(avg);
} else {
if (success == -SIGERR_CLIP) {
LOG(ALERT) << "Clipping detected on RACH input";
} else {
LOG(ALERT) << "Unhandled RACH error";
}
delete rxBurst;
return NULL;
}
}
// demodulate burst

View File

@@ -30,6 +30,8 @@
extern "C" {
#include "convolve.h"
}
/* Clipping detection threshold */
#define CLIP_THRESH 30000.0f
#define TABLESIZE 1024
@@ -1241,7 +1243,7 @@ static int detectBurst(signalVector &burst,
/* Correlate */
if (!convolve(&burst, sync->sequence, &corr,
CUSTOM, start, len, sps, 0)) {
return -1;
return -SIGERR_INTERNAL;
}
/* Peak detection - place restrictions at correlation edges */
@@ -1270,6 +1272,18 @@ static int detectBurst(signalVector &burst,
return 1;
}
static int detectClipping(signalVector &burst, float thresh)
{
for (size_t i = 0; i < burst.size(); i++) {
if (fabs(burst[i].real()) > thresh)
return 1;
if (fabs(burst[i].imag()) > thresh)
return 1;
}
return 0;
}
/*
* RACH burst detection
*
@@ -1291,7 +1305,10 @@ int detectRACHBurst(signalVector &rxBurst,
CorrelationSequence *sync;
if ((sps != 1) && (sps != 4))
return -1;
return -SIGERR_UNSUPPORTED;
if (detectClipping(rxBurst, CLIP_THRESH))
return -SIGERR_CLIP;
target = 8 + 40;
head = 4;
@@ -1342,7 +1359,7 @@ int analyzeTrafficBurst(signalVector &rxBurst, unsigned tsc, float thresh,
CorrelationSequence *sync;
if ((tsc < 0) || (tsc > 7) || ((sps != 1) && (sps != 4)))
return -1;
return -SIGERR_UNSUPPORTED;
target = 3 + 58 + 16 + 5;
head = 4;
@@ -1356,7 +1373,7 @@ int analyzeTrafficBurst(signalVector &rxBurst, unsigned tsc, float thresh,
rc = detectBurst(rxBurst, corr, sync,
thresh, sps, &_amp, &_toa, start, len);
if (rc < 0) {
return -1;
return -SIGERR_INTERNAL;
} else if (!rc) {
if (amp)
*amp = 0.0f;

View File

@@ -36,6 +36,14 @@ enum ConvType {
UNDEFINED,
};
enum signalError {
SIGERR_NONE,
SIGERR_BOUNDS,
SIGERR_CLIP,
SIGERR_UNSUPPORTED,
SIGERR_INTERNAL,
};
/** the core data structure of the Transceiver */
class signalVector: public Vector<complex>
{