int ReadDeviceId(Rhd2000DataBlock dataBlock, int stream, out int register59Value) { // First, check ROM registers 32-36 to verify that they hold 'INTAN', and // the initial chip name ROM registers 24-26 that hold 'RHD'. // This is just used to verify that we are getting good data over the SPI // communication channel. var intanChipPresent = ( (char)dataBlock.AuxiliaryData[stream][2, 32] == 'I' && (char)dataBlock.AuxiliaryData[stream][2, 33] == 'N' && (char)dataBlock.AuxiliaryData[stream][2, 34] == 'T' && (char)dataBlock.AuxiliaryData[stream][2, 35] == 'A' && (char)dataBlock.AuxiliaryData[stream][2, 36] == 'N' && (char)dataBlock.AuxiliaryData[stream][2, 24] == 'R' && (char)dataBlock.AuxiliaryData[stream][2, 25] == 'H' && (char)dataBlock.AuxiliaryData[stream][2, 26] == 'D'); // If the SPI communication is bad, return -1. Otherwise, return the Intan // chip ID number stored in ROM regstier 63. if (!intanChipPresent) { register59Value = -1; return(-1); } else { register59Value = dataBlock.AuxiliaryData[stream][2, 23]; // Register 59 return(dataBlock.AuxiliaryData[stream][2, 19]); // chip ID (Register 63) } }
Rhd2000DataBlock RunSingleCommandSequence() { // Start SPI interface. evalBoard.Run(); // Wait for the 60-sample run to complete. while (evalBoard.IsRunning()) { Thread.Sleep(0); } // Read the resulting single data block from the USB interface. var dataBlock = new Rhd2000DataBlock(evalBoard.GetNumEnabledDataStreams(), evalBoard.IsUsb3()); evalBoard.ReadDataBlock(dataBlock); return(dataBlock); }
private void Load() { evalBoard = new Rhythm.Net.Rhd2000EvalBoard(); // Open Opal Kelly XEM6010 board. evalBoard.Open(); samplesPerBlock = Rhd2000DataBlock.GetSamplesPerDataBlock(evalBoard.IsUsb3()); try { // Load Rhythm FPGA configuration bitfile (provided by Intan Technologies). evalBoard.UploadFpgaBitfile(BitFileName); // Initialize interface board. evalBoard.Initialize(); // Set sample rate and upload all auxiliary SPI command sequences. ChangeSampleRate(SampleRate); // Run ADC calibration RunCalibration(); // Set default configuration for all eight DACs on interface board. SetDacDefaultConfiguration(); // Find amplifier chips connected to interface board and compute their // optimal delay parameters. ScanConnectedAmplifiers(); } catch { // Close interface board in case of configuration errors evalBoard.Close(); throw; } }