From 742408eac82801f712a3791de9c384e774f66437 Mon Sep 17 00:00:00 2001 From: Josh Siegle <jsiegle@mit.edu> Date: Tue, 6 Aug 2013 21:22:45 -0400 Subject: [PATCH] Use Opal Kelly library to reset FPGA after use. This should help reduce overheating. --- Source/Processors/DataThreads/RHD2000Thread.cpp | 6 +++++- .../Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp | 6 ++++++ Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/Processors/DataThreads/RHD2000Thread.cpp b/Source/Processors/DataThreads/RHD2000Thread.cpp index 6b6bfe0b6..c754d3e98 100644 --- a/Source/Processors/DataThreads/RHD2000Thread.cpp +++ b/Source/Processors/DataThreads/RHD2000Thread.cpp @@ -36,6 +36,7 @@ RHD2000Thread::RHD2000Thread(SourceNode* sn) : DataThread(sn), isTransmitting(fa dataBuffer = new DataBuffer(2, 10000); // start with 2 channels and automatically resize // Open Opal Kelly XEM6010 board. + // Returns 1 if successful, -1 if FrontPanel cannot be loaded, and -2 if XEM6010 can't be found. int return_code = evalBoard->open(); if (return_code == 1) @@ -54,7 +55,7 @@ RHD2000Thread::RHD2000Thread(SourceNode* sn) : DataThread(sn), isTransmitting(fa initializeBoard(); // automatically find connected headstages - scanPorts(); // do this after the editor has been created? + scanPorts(); // things would run more smoothly if this were done after the editor has been created } } @@ -70,6 +71,9 @@ RHD2000Thread::~RHD2000Thread() evalBoard->setLedDisplay(ledArray); } + if (deviceFound) + evalBoard->resetFpga(); + deleteAndZero(dataBlock); } diff --git a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp index 80d84aa07..3b294bbf7 100755 --- a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp +++ b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.cpp @@ -173,6 +173,12 @@ bool Rhd2000EvalBoard::uploadFpgaBitfile(string filename) return(true); } +// Uses the Opal Kelly library to reset the FPGA +void Rhd2000EvalBoard::resetFpga() +{ + dev->ResetFPGA(); +} + // Reads system clock frequency from Opal Kelly board (in MHz). Should be 100 MHz for normal // Rhythm operation. double Rhd2000EvalBoard::getSystemClockFreq() const diff --git a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h index 51df0829f..386632401 100755 --- a/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h +++ b/Source/Processors/DataThreads/rhythm-api/rhd2000evalboard.h @@ -153,6 +153,8 @@ public: bool readDataBlocks(int numBlocks, queue<Rhd2000DataBlock> &dataQueue); int queueToFile(queue<Rhd2000DataBlock> &dataQueue, std::ofstream& saveOut); + void resetFpga(); + private: okCFrontPanel* dev; AmplifierSampleRate sampleRate; -- GitLab