Download RHD2000 USB/FPGA Interface: Rhythm
Transcript
RHD2000 USB/FPGA Interface: Rhythm
In order to minimize communication overhead and achieve maximum USB transfer speeds, Opal Kelly recommends reading
from PipeOuts in relatively large data blocks. Reading at least 5 milliseconds of accumulated amplifier data from the board at a
time will provide adequate USB data rates in most cases. See the Opal Kelly FrontPanel User’s Manual for more information.
PipeOut 0xA0: PipeOutData
This PipeOut is used to stream data from all RHD2000 chips (and several additional data sources) through the FPGA to the host
computer. The PipeOut is backed by a large FIFO implemented using the 128 MByte SDRAM on the Opal Kelly board. This
FIFO module allows continuously-streaming data (e.g., from multiple RHD2000 chips to be transferred smoothly over a USB
interface to a computer that will grab the data in bursts, and may be unresponsive for a brief time due to multitasking or other
operating system overhead.
There is no mechanism in this FIFO to protect against underflow. That is, if the computer tries to read more data than the FIFO
is currently holding, the FIFO will just repeat the last word after it runs out of data. To prevent underflow, it is essential for the
host to monitor the value of NumWords (WireOut 0x20 and 0x21) and never attempt to read more words than the FIFO
contains.
Example:
okCFrontPanel *dev;
// Code to open Opal Kelly board and start SPI operation not shown here.
// Allocate buffer to store data.
unsigned char usbBuffer[BUFFERSIZE];
// Wait until enough data is available in the FIFO...
unsigned int numWordsAvailable = 0;
while (numWordsAvailable < BUFFERSIZE / 2) {
dev->UpdateWireOuts();
numWordsAvailable = 65536 * dev->GetWireOutValue(0x21) +
dev->GetWireOutValue(0x20);
}
// Remember, NumWords (WireOut 0x20 and 0x21) returns the number of 16-bit words in
// the FIFO, but ReadFromPipeOut() operates on bytes. Factor of two difference!
// Read bytes from PipeOut 0xA0 into buffer.
long numBytesRead;
numBytesRead = dev->ReadFromPipeOut(0xA0, BUFFERSIZE, usbBuffer);
intan
TECHNOLOGIES, LLC
www.intantech.com ● info@intantech.com
21