From 73f94554acac2876393f4f5aea06b1ea069c1460 Mon Sep 17 00:00:00 2001 From: Aaron Cuevas Lopez <aacuelo@teleco.upv.es> Date: Tue, 24 Nov 2015 15:48:34 +0100 Subject: [PATCH] Fix impedance measurement with usb3 --- .../DataThreads/rhythm-api/rhd2000evalboard.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp index 3abe422ac..8e58ce35d 100755 --- a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp +++ b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp @@ -1397,7 +1397,7 @@ void Rhd2000EvalBoard::flush() while (numWordsInFifo() > 0) { dev->ReadFromBlockPipeOut(PipeOutData, USB3_BLOCK_SIZE, USB3_BLOCK_SIZE *max(2 * numWordsInFifo() / USB3_BLOCK_SIZE, (unsigned int)1), usbBuffer); // cout << "Flush phase B: " << numWordsInFifo() << endl; - printFIFOmetrics(); + // printFIFOmetrics(); } dev->SetWireInValue(WireInResetRun, 0, 1 << 16); dev->UpdateWireIns(); @@ -1488,6 +1488,7 @@ bool Rhd2000EvalBoard::readDataBlocks(int numBlocks, queue<Rhd2000DataBlock> &da unsigned int numWordsToRead, numBytesToRead; int i; Rhd2000DataBlock *dataBlock; + long res; numWordsToRead = numBlocks * dataBlock->calculateDataBlockSizeInWords(numDataStreams, usb3); @@ -1502,7 +1503,18 @@ bool Rhd2000EvalBoard::readDataBlocks(int numBlocks, queue<Rhd2000DataBlock> &da return false; } - dev->ReadFromPipeOut(PipeOutData, numBytesToRead, usbBuffer); + if (usb3) + { + res = dev->ReadFromBlockPipeOut(PipeOutData, USB3_BLOCK_SIZE, numBytesToRead, usbBuffer); + } + else + { + res = dev->ReadFromPipeOut(PipeOutData, numBytesToRead, usbBuffer); + } + if (res == ok_Timeout) + { + cerr << "CRITICAL: Timeout on pipe read. Check block and buffer sizes." << endl; + } dataBlock = new Rhd2000DataBlock(numDataStreams, usb3); for (i = 0; i < numBlocks; ++i) { -- GitLab