sigproc: Add clipping detection on RACH and TSC input
Alert user of overdriven burst 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@ettus.com>
This commit is contained in:
parent
88bbf1aafd
commit
577cd020c1
|
@ -615,8 +615,16 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, int &RSSI,
|
||||||
else
|
else
|
||||||
success = detectRACH(state, *burst, amp, toa);
|
success = detectRACH(state, *burst, amp, toa);
|
||||||
|
|
||||||
|
/* Update noise average if no bust detected or alert on error */
|
||||||
|
if (success <= 0) {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
state->mNoises.insert(avg);
|
state->mNoises.insert(avg);
|
||||||
|
} else if (success == -SIGERR_CLIP) {
|
||||||
|
LOG(ALERT) << "Clipping detected on RACH input";
|
||||||
|
} else if (success < 0) {
|
||||||
|
LOG(ALERT) << "Unhandled RACH error";
|
||||||
|
}
|
||||||
|
|
||||||
delete radio_burst;
|
delete radio_burst;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,9 @@ using namespace GSM;
|
||||||
#define TABLESIZE 1024
|
#define TABLESIZE 1024
|
||||||
#define DELAYFILTS 64
|
#define DELAYFILTS 64
|
||||||
|
|
||||||
|
/* Clipping detection threshold */
|
||||||
|
#define CLIP_THRESH 30000.0f
|
||||||
|
|
||||||
/** Lookup tables for trigonometric approximation */
|
/** Lookup tables for trigonometric approximation */
|
||||||
float cosTable[TABLESIZE+1]; // add 1 element for wrap around
|
float cosTable[TABLESIZE+1]; // add 1 element for wrap around
|
||||||
float sinTable[TABLESIZE+1];
|
float sinTable[TABLESIZE+1];
|
||||||
|
@ -1369,6 +1372,18 @@ static int detectBurst(signalVector &burst,
|
||||||
return 1;
|
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
|
* RACH burst detection
|
||||||
*
|
*
|
||||||
|
@ -1390,7 +1405,10 @@ int detectRACHBurst(signalVector &rxBurst,
|
||||||
CorrelationSequence *sync;
|
CorrelationSequence *sync;
|
||||||
|
|
||||||
if ((sps != 1) && (sps != 4))
|
if ((sps != 1) && (sps != 4))
|
||||||
return -1;
|
return -SIGERR_UNSUPPORTED;
|
||||||
|
|
||||||
|
if (detectClipping(rxBurst, CLIP_THRESH))
|
||||||
|
return -SIGERR_CLIP;
|
||||||
|
|
||||||
target = 8 + 40;
|
target = 8 + 40;
|
||||||
head = 4;
|
head = 4;
|
||||||
|
@ -1406,7 +1424,7 @@ int detectRACHBurst(signalVector &rxBurst,
|
||||||
delete corr;
|
delete corr;
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
return -1;
|
return -SIGERR_INTERNAL;
|
||||||
} else if (!rc) {
|
} else if (!rc) {
|
||||||
if (amp)
|
if (amp)
|
||||||
*amp = 0.0f;
|
*amp = 0.0f;
|
||||||
|
@ -1443,7 +1461,10 @@ int analyzeTrafficBurst(signalVector &rxBurst, unsigned tsc, float thresh,
|
||||||
CorrelationSequence *sync;
|
CorrelationSequence *sync;
|
||||||
|
|
||||||
if ((tsc < 0) || (tsc > 7) || ((sps != 1) && (sps != 4)))
|
if ((tsc < 0) || (tsc > 7) || ((sps != 1) && (sps != 4)))
|
||||||
return -1;
|
return -SIGERR_UNSUPPORTED;
|
||||||
|
|
||||||
|
if (detectClipping(rxBurst, CLIP_THRESH))
|
||||||
|
return -SIGERR_CLIP;
|
||||||
|
|
||||||
target = 3 + 58 + 16 + 5;
|
target = 3 + 58 + 16 + 5;
|
||||||
head = 4;
|
head = 4;
|
||||||
|
@ -1459,7 +1480,7 @@ int analyzeTrafficBurst(signalVector &rxBurst, unsigned tsc, float thresh,
|
||||||
delete corr;
|
delete corr;
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
return -1;
|
return -SIGERR_INTERNAL;
|
||||||
} else if (!rc) {
|
} else if (!rc) {
|
||||||
if (amp)
|
if (amp)
|
||||||
*amp = 0.0f;
|
*amp = 0.0f;
|
||||||
|
|
|
@ -28,6 +28,14 @@ enum ConvType {
|
||||||
UNDEFINED,
|
UNDEFINED,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum signalError {
|
||||||
|
SIGERR_NONE,
|
||||||
|
SIGERR_BOUNDS,
|
||||||
|
SIGERR_CLIP,
|
||||||
|
SIGERR_UNSUPPORTED,
|
||||||
|
SIGERR_INTERNAL,
|
||||||
|
};
|
||||||
|
|
||||||
/** Convert a linear number to a dB value */
|
/** Convert a linear number to a dB value */
|
||||||
float dB(float x);
|
float dB(float x);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue