aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Tsou <ttsou@vt.edu>2012-03-20 16:29:43 -0400
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2013-06-24 01:51:02 +0400
commitafb04f8b631b6727db0bc62802f2bf50cf39503a (patch)
tree893633210ebf37de52ca3abb6503074f70cd801c
parent5f13377b83bc5bfafaf6b150a4b507f190cee585 (diff)
multi-arfcn, trx: fix infinite energy threshold bug
This fixes a bug where the energy threshold may reach infinity. The transceiver energy detection threshold increase is dependent on elapsed frames and the previous false detection time. If we assume a (0,0) start time with the actual start time - randomly determined - it's possible to get very large elapsed frame counts at start. Once the threshold hits 'inf' further calculations are impossible and transceiver is locked out from use. Use the actual start time for initializing variables so we avoid this scenario. Signed-off-by: Thomas Tsou <ttsou@vt.edu>
-rw-r--r--Transceiver52M/DriveLoop.cpp9
-rw-r--r--Transceiver52M/DriveLoop.h3
-rw-r--r--Transceiver52M/Transceiver.cpp6
3 files changed, 11 insertions, 7 deletions
diff --git a/Transceiver52M/DriveLoop.cpp b/Transceiver52M/DriveLoop.cpp
index cbd2993..c925d20 100644
--- a/Transceiver52M/DriveLoop.cpp
+++ b/Transceiver52M/DriveLoop.cpp
@@ -33,12 +33,13 @@ DriveLoop::DriveLoop(int wSamplesPerSymbol,
mSamplesPerSymbol = wSamplesPerSymbol;
mRadioInterface = wRadioInterface;
- GSM::Time startTime(random() % gHyperframe, 0);
- mTransmitDeadlineClock = startTime;
- mLatencyUpdateTime = startTime;
+ mStartTime = (random() % gHyperframe, 0);
+
+ mTransmitDeadlineClock = mStartTime;
+ mLatencyUpdateTime = mStartTime;
mTransmitLatency = wTransmitLatency;
- mRadioInterface->getClock()->set(startTime);
+ mRadioInterface->getClock()->set(mStartTime);
// generate pulse and setup up signal processing library
gsmPulse = generateGSMPulse(2, mSamplesPerSymbol);
diff --git a/Transceiver52M/DriveLoop.h b/Transceiver52M/DriveLoop.h
index df54ef7..593ef58 100644
--- a/Transceiver52M/DriveLoop.h
+++ b/Transceiver52M/DriveLoop.h
@@ -58,6 +58,7 @@ private:
Thread *mRadioDriveLoopThread; ///< thread to push/pull bursts into transmit/receive FIFO
GSM::Time mTransmitDeadlineClock; ///< deadline for pushing bursts into transmit FIFO
+ GSM::Time mStartTime; ///< random start time of the radio clock
RadioInterface *mRadioInterface; ///< associated radioInterface object
double txFullScale; ///< full scale input to radio
@@ -149,6 +150,8 @@ public:
mChanType[m][timeslot] = comb;
}
+ GSM::Time getStartTime() { return mStartTime; }
+
private:
ChannelCombination mChanType[CHAN_M][8]; ///< channel types for all timeslots
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index ff8c12e..0d7776f 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -66,7 +66,7 @@ Transceiver::Transceiver(int wBasePort,
mSamplesPerSymbol = wSamplesPerSymbol;
mRadioInterface = wRadioInterface;
- mLastClockUpdateTime = GSM::Time(0, 0);
+ mLastClockUpdateTime = mDriveLoop->getStartTime();
mMaxExpectedDelay = 0;
mTransmitDeadlineClock = wDriveLoop->deadlineClock();
@@ -83,7 +83,7 @@ Transceiver::Transceiver(int wBasePort,
channelResponse[i] = NULL;
DFEForward[i] = NULL;
DFEFeedback[i] = NULL;
- channelEstimateTime[i] = GSM::Time(0, 0);
+ channelEstimateTime[i] = mDriveLoop->getStartTime();
}
mOn = false;
@@ -92,7 +92,7 @@ Transceiver::Transceiver(int wBasePort,
mRxFreq = 0.0;
mPower = -10;
mEnergyThreshold = INIT_ENERGY_THRSHD;
- prevFalseDetectionTime = GSM::Time(0, 0);
+ prevFalseDetectionTime = mDriveLoop->getStartTime();
mRadioLocked = mRadioInterface->started();
}