Tom Tsou has submitted this change and it was merged.

Change subject: transceiver: Avoid sending clock indications when trx is not 
powered on
......................................................................


transceiver: Avoid sending clock indications when trx is not powered on

Stop calling writeClockInterface() when receiving commands in 
Transceiver::driveControl,
otherwise it fools osmo-bts-trx clock skew check because it is always sending a 
clock
indication with the same fn when it issues any commands during the time in 
between
CMD POWEROFF and RSP POWERON, because fn is not increased during that period.

Also use mForceClockInterface flag to delay delivery of first IND CLOCK until 
we start
serving frames, otherwise the first one is sent and only after a long period of 
time
the next clock indications are sent, when the radio starts to process bursts. 
That makes
osmo-bts-trx unhappy because it expects to receive an IND CLOCK aprox at least 
every
400 frames. This way also we send the first IND CLOCK after the RSP POWERON 0 
response.

Change-Id: I91b81a4d7627cec39c1814a39ed4be306681b874
---
M Transceiver52M/Transceiver.cpp
M Transceiver52M/Transceiver.h
2 files changed, 6 insertions(+), 8 deletions(-)

Approvals:
  Tom Tsou: Looks good to me, approved
  Alexander Chemeris: Looks good to me, but someone else must approve
  Neels Hofmeyr: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index d5b75d7..bf2dd6e 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -121,7 +121,7 @@
     mClockSocket(wBasePort, wTRXAddress, mBasePort + 100),
     mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface),
     rssiOffset(wRssiOffset),
-    mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans), mEdge(false), mOn(false),
+    mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans), mEdge(false), mOn(false), 
mForceClockInterface(false),
     mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelayAB(0), 
mMaxExpectedDelayNB(0),
     mWriteBurstToDiskMask(0)
 {
@@ -273,7 +273,7 @@
                             TxUpperLoopAdapter, (void*) chan);
   }
 
-  writeClockInterface();
+  mForceClockInterface = true;
   mOn = true;
   return true;
 }
@@ -677,9 +677,6 @@
 
   sscanf(buffer,"%3s %s",cmdcheck,command);
 
-  if (!chan)
-    writeClockInterface();
-
   if (strcmp(cmdcheck,"CMD")!=0) {
     LOG(WARNING) << "bogus message on control interface";
     return;
@@ -873,9 +870,9 @@
 {
   if (!mRadioInterface->driveReceiveRadio()) {
     usleep(100000);
-  } else {
-    if (mTransmitDeadlineClock > mLastClockUpdateTime + GSM::Time(216,0))
-      writeClockInterface();
+  } else if (mForceClockInterface || mTransmitDeadlineClock > 
mLastClockUpdateTime + GSM::Time(216,0)) {
+    mForceClockInterface = false;
+    writeClockInterface();
   }
 }
 
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index 26d6c3c..1eb1d1d 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -208,6 +208,7 @@
 
   bool mEdge;
   bool mOn;                               ///< flag to indicate that 
transceiver is powered on
+  bool mForceClockInterface;           ///< flag to indicate whether IND CLOCK 
shall be sent unconditionally after transceiver is started
   bool mHandover[8][8];                ///< expect handover to the 
timeslot/subslot
   double mTxFreq;                      ///< the transmit frequency
   double mRxFreq;                      ///< the receive frequency

-- 
To view, visit https://gerrit.osmocom.org/3120
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I91b81a4d7627cec39c1814a39ed4be306681b874
Gerrit-PatchSet: 3
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Alexander Chemeris <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Tom Tsou <[email protected]>

Reply via email to