Move FPGA register write in Streamer::UpdateThreads()
write to 0xFFFF should be done only if other writes to FPGA are required
@@ -550,10 +550,11 @@ int Streamer::UpdateThreads(bool stopAll)
terminateRx.store(true);
rxThread.join();
}
- dataPort->WriteRegister(0xFFFF, 1 << chipId);
+
//configure FPGA on first start, or disable FPGA when not streaming
if((needTx || needRx) && (!txThread.joinable()) && (!rxThread.joinable()))
{
+ dataPort->WriteRegister(0xFFFF, 1 << chipId);
if (mRxStreams[0].used && mRxStreams[1].used)
AlignRxRF(true);
//enable FPGA streaming
@@ -611,6 +612,7 @@ int Streamer::UpdateThreads(bool stopAll)
else if(not needTx and not needRx)
{
//disable FPGA streaming
+ dataPort->WriteRegister(0xFFFF, 1 << chipId);
fpga->StopStreaming();
}
@@ -623,6 +625,7 @@ int Streamer::UpdateThreads(bool stopAll)
}
if(needTx && (!txThread.joinable()))
{
+ dataPort->WriteRegister(0xFFFF, 1 << chipId);
dataPort->WriteRegister(0xD, 0); //stop WFM
terminateTx.store(false);
auto TxLoopFunction = std::bind(&Streamer::TransmitPacketsLoop, this);
