public static void initATIS(string filename)
        {
            // detect Opal Kelly and Program
            dev = new okCFrontPanel();
            int num_boards = 0;
            bool device_opened = false;
            lock (dev)
            {
                while (device_opened == false)
                { 
                    num_boards = dev.GetDeviceCount();
                
                    for(int i=0; i < num_boards; i++)
                    {
                        if (dev.GetDeviceListModel(i) == okCFrontPanel.BoardModel.brdXEM6010LX150)
                        {
                            dev.OpenBySerial(dev.GetDeviceListSerial(i));
                            device_opened = true;
                        }
                    }
                }
                /*
                while (dev.OpenBySerial("") != okCFrontPanel.ErrorCode.NoError)
                {

                }//wait for Opal Kelly to be plugged in
                */
                dev.LoadDefaultPLLConfiguration();
                dev.ConfigureFPGA(filename);
            }

            // Initialize the Biases
            BiasesInterface.initBiases();
        }
        public static void initATIS(string filename)
        {
            // detect Opal Kelly and Program
            dev = new okCFrontPanel();
            int  num_boards    = 0;
            bool device_opened = false;

            lock (dev)
            {
                while (device_opened == false)
                {
                    num_boards = dev.GetDeviceCount();

                    for (int i = 0; i < num_boards; i++)
                    {
                        if (dev.GetDeviceListModel(i) == okCFrontPanel.BoardModel.brdXEM6010LX150)
                        {
                            dev.OpenBySerial(dev.GetDeviceListSerial(i));
                            device_opened = true;
                        }
                    }
                }

                /*
                 * while (dev.OpenBySerial("") != okCFrontPanel.ErrorCode.NoError)
                 * {
                 *
                 * }//wait for Opal Kelly to be plugged in
                 */
                dev.LoadDefaultPLLConfiguration();
                dev.ConfigureFPGA(filename);
            }

            // Initialize the Biases
            BiasesInterface.initBiases();
        }
示例#3
0
        // public methods

        /// <summary>
        /// Attempt to open Opal Kelly XEM3010 USB FPGA board.
        /// </summary>
        /// <param name="dataRate">Data rate (High, Medium, or Low).</param>
        /// <param name="boardID">Board ID number.</param>
        /// <param name="boardVersion">Board version number.</param>
        /// <returns>Board name.</returns>
        public string Open(DataRate dataRate, out int boardID, out int boardVersion)
        {
            boardID      = -1;
            boardVersion = -1;

            // Open Opal Kelly XEM3010 board
            myXEM = new okCFrontPanel();

            if (myXEM.OpenBySerial("") != okCFrontPanel.ErrorCode.NoError)
            {
                UsbException e = new UsbException("USB Setup Error: Could not find USB board.");
                throw e;
            }

            // Setup the PLL from the stored configuration.
            myXEM.LoadDefaultPLLConfiguration();

            // Read back the CY22393 PLL configuation (6/3/11)
            okCPLL22393 myPLL = new okCPLL22393();

            myXEM.GetEepromPLL22393Configuration(myPLL);

            // Modify PLL settings from default
            myPLL.SetOutputDivider(0, 5); // set clk1 to 80 MHz (normally 4 = 100 MHz)
            myPLL.SetOutputDivider(1, 8); // set clk2 to 50 MHz (normally 4 = 100 MHz)
            // ... 8 works at 30 MHz with state 7 present (BER = 5.3e-4), zero BER at 20 MHz
            myXEM.SetPLL22393Configuration(myPLL);

            // Download the configuration file.
            if (okCFrontPanel.ErrorCode.NoError != myXEM.ConfigureFPGA("bug3a_receiver_1.bit"))
            {
                UsbException e = new UsbException("USB Setup Error: FPGA configuration failed.");
                throw e;
            }

            Debug.WriteLine("FPGA configuration complete.");

            // Check for FrontPanel support in the FPGA configuration.
            if (false == myXEM.IsFrontPanelEnabled())
            {
                UsbException e = new UsbException("USB Setup Error: FrontPanel support is not available.");
                throw e;
            }

            // Reset FIFOs
            myXEM.SetWireInValue(wireInResetReadWrite, 0x04);
            myXEM.UpdateWireIns();
            myXEM.SetWireInValue(wireInResetReadWrite, 0x00);
            myXEM.UpdateWireIns();

            // Turn raw data mode off by default
            myXEM.SetWireInValue(wireInRawDataMode, 0x00);
            myXEM.UpdateWireIns();

            myXEM.UpdateWireOuts();
            boardID      = (int)myXEM.GetWireOutValue(wireOutBoardID);
            boardVersion = (int)myXEM.GetWireOutValue(wireOutBoardVersion);

            string boardName;

            boardName = myXEM.GetDeviceID();
            // Debug.WriteLine("Board ID: " + boardID);
            return(boardName);
        }