lucabaldini / xpedaq

Data acquisition software for the X-ray polarimetry explorers
GNU General Public License v2.0
0 stars 0 forks source link

Data acquisition in large buffer mode running at ~half the rate #80

Closed lucabaldini closed 8 years ago

lucabaldini commented 8 years ago

Which means that we're throwing away half of the data. Needless to say, this is important to fix.

lucabaldini commented 8 years ago

Some background information, based on a discussion with Massimo.

The inner loop of the data acquisition is a (blocking) USB read command looking like

unsigned long dataBufferDimension = SRAM_DIM*2;
unsigned char dataBuffer[SRAM_DIM*2];
while (m_running) {
    errorCode = m_usbController->readData(dataBuffer, &dataBufferDimension);
}

The FPGA is always sending 2 * 2**18 = 2* 262144 = 2 * SRAM_DIM = 524288 bytes or 512 kB of data at each transfer, no matter what the readout configuration (full frame, windowed with small buffer or windowed with long buffer) is.

The amount of usable data in the buffer read from the USB port depends on the readout mode and is effectively:

lucabaldini commented 8 years ago

A first quick fix committed

diff --git a/daq/xpoldetector.cpp b/daq/xpoldetector.cpp
index 9851bc8..bd4be38 100644
--- a/daq/xpoldetector.cpp
+++ b/daq/xpoldetector.cpp
@@ -157,4 +157,4 @@ unsigned short int xpoldetector::kSmallBufferMode = 0x1;
 unsigned short int xpoldetector::kLargeBufferMode = ~xpoldetector::kSmallBuffer

 int xpoldetector::kSmallBufferSize = 10000;
-int xpoldetector::kLargeBufferSize = 211968;  //rounded to 207 1024 data blocks
+int xpoldetector::kLargeBufferSize = 2*262144;
lucabaldini commented 8 years ago

I am closing this one, noting that we shall revisit this if and when we address issue #85