示例#1
0
        protected override void CreateWaveforms(NIDigital session)
        {
            base.CreateWaveforms(session);
            var pinSet = session.PinAndChannelMap.GetPinSet(pin);

            session.CaptureWaveforms.CreateSerial(pinSet, Name, 8, BitOrder.MostSignificantBitFirst);
        }
        public static void Main()
        {
            string DigitalPath = Path.GetFullPath(@"Digital Project");

            string pinMapPath = Path.Combine(DigitalPath, "PinMap.pinmap");
            string specPath   = Path.Combine(DigitalPath, "Specifications.specs");
            string levelsPath = Path.Combine(DigitalPath, "PinLevels.digilevels");
            string timingPath = Path.Combine(DigitalPath, "Timing.digitiming");

            string[] patternPaths = Directory.GetFiles(Path.Combine(DigitalPath, "RFFE Command Patterns"), "*.digipat");

            ProjectFiles projectFiles = new ProjectFiles
            {
                PinMapFile          = pinMapPath,
                SpecificationsFiles = new string[1] {
                    specPath
                },
                PinLevelsFiles = new string[1] {
                    levelsPath
                },
                TimingFiles = new string[1] {
                    timingPath
                },
                DigitalPatternFiles = patternPaths
            };

            //Initialize hardware and load pinmap plus sheets into
            //digital pattern instrument. Most of the fucntions below are
            //a lightweight wrapper around NI - Digital functions.

            //If you change the insturment name below, you must also change the instrument name
            //in the PinMap file
            NIDigital digital = new NIDigital("PXIe-6570", false, false, "");

            LoadProjectFiles(digital, projectFiles);

            //Turn RFFE bus power on
            digital.PinAndChannelMap.GetPinSet("RFFEVIO").WriteStatic(PinState._1);

            //Setup new register data to send to register 0
            RegisterData regData = new RegisterData {
                SlaveAddress      = 0xF, //15
                WriteRegisterData = new byte[1] {
                    0x8
                },
                ByteCount = 1
            };

            //Trgger type is set to none so burst will start immediately
            TriggerConfiguration triggerConfig = new TriggerConfiguration {
                BurstTriggerType = TriggerType.None,
            };

            //Burst a Reg0Write command using the data specified in regData
            BurstRFFE(digital, regData, "RFFEDATA", RFFECommand.Reg0Write, triggerConfig);

            Console.ReadKey();

            DisconnectAndClose(digital);
        }
 public static void ApplyPinTDROffset(NIDigital nIDigital, string pinName, double cableDelay_s)
 {
     //Create a new PrecisionTimeSpan array with the cable delay value
     PrecisionTimeSpan[] offsets = new PrecisionTimeSpan[1] {
         PrecisionTimeSpan.FromSeconds(cableDelay_s)
     };
     nIDigital.PinAndChannelMap.GetPinSet(pinName).ApplyTdrOffsets(offsets);
 }
示例#4
0
        public override void Burst(NIDigital session, int busNumber, double timeout = 10.0)
        {
            base.Burst(session, busNumber, timeout);
            string siteList = FormatSiteList(busNumber);

            uint[][] captureData = null;
            captureData   = session.CaptureWaveforms.Fetch(siteList, Name, ByteCount, TimeSpan.FromSeconds(timeout), ref captureData);
            _registerData = captureData[0].Select(num => { return((byte)num); }).ToArray();
        }
示例#5
0
 static void CreateRFFEWaveforms(NIDigital niDigital, string pinName, RFFECommand rffeCommand)
 {
     //Create 1 bit sample width source and 8 bit sample width capture waveforms,
     //using appropriate name for the command.
     niDigital.SourceWaveforms.CreateSerial(pinName, rffeCommand.SourceName,
                                            SourceDataMapping.Broadcast, 1, BitOrder.MostSignificantBitFirst);
     niDigital.CaptureWaveforms.CreateSerial(pinName, rffeCommand.SourceName,
                                             8, BitOrder.MostSignificantBitFirst);
 }
示例#6
0
        public virtual void Burst(NIDigital session, int busNumber, double timeout = 10.0)
        {
            CreateWaveforms(session);
            uint[] sourceWaveform = BuildSourceWaveform();
            WriteSourceWaveform(session, sourceWaveform);
            string siteList = FormatSiteList(busNumber);

            session.PatternControl.BurstPattern(siteList, Name, true, TimeSpan.FromSeconds(timeout));
        }
        static void Main()
        {
            NIDigital digital = new NIDigital("PXIe-6570", false, false, "");

            string pinMapPath  = Path.GetFullPath(@"Support Files\PinMap.pinmap");
            string specPath    = Path.GetFullPath(@"Support Files\Specifications.specs");
            string levelsPath  = Path.GetFullPath(@"Support Files\PinLevels.digilevels");
            string timingPath  = Path.GetFullPath(@"Support Files\Timing.digitiming");
            string patternPath = Path.GetFullPath(@"Support Files\Pattern.digipat");

            ProjectFiles projectFiles = new ProjectFiles
            {
                PinMapFile          = pinMapPath,
                SpecificationsFiles = new string[1] {
                    specPath
                },
                PinLevelsFiles = new string[1] {
                    levelsPath
                },
                TimingFiles = new string[1] {
                    timingPath
                },
                DigitalPatternFiles = new string[1] {
                    patternPath
                }
            };

            // Alternatively, you could use the following command to search for all matching NI-Digital project files
            // projectFiles = Digital.Utilities.SearchForProjectFiles(Path.GetFullPath(@"Support Files\"), true)

            LoadProjectFiles(digital, projectFiles);

            SourcePinConfiguration sourcePin = SourcePinConfiguration.GetDefault();

            sourcePin.PinName = "DUTPin1";

            ConfigureAndSourcePin(digital, sourcePin);

            TriggerConfiguration triggerConfig = new TriggerConfiguration
            {
                BurstTriggerType = TriggerType.None
            };


            InitiatePatternGeneration(digital, "new_pattern", triggerConfig);

            Console.WriteLine("Pattern generation has begun. Press any key to abort, disconnect pins, and close the program.");
            Console.ReadKey();

            digital.PatternControl.Abort();

            DisconnectAndClose(digital);
        }
示例#8
0
        static void Main(string[] args)
        {
            // open session and load digital project
            NIDigital session = new NIDigital("PXIe-6570", true, false);

            MipiRffe.LoadDigitalProject(session);

            // create and enable mipi bus
            MipiRffe bus0 = new MipiRffe(session, 0);

            bus0.EnableVIO();

            // build command lists
            List <RffeCommand> writeCommands = new List <RffeCommand>();
            List <RffeCommand> readCommands  = new List <RffeCommand>();

            foreach (var commandParameters in Rfmd8090.Band1Apt)
            {
                var(slaveAddress, registerAddress, writeData) = commandParameters;

                RffeCommand writeCommand = new RffeExtendedRegisterWriteCommand(slaveAddress, registerAddress, writeData);
                writeCommands.Add(writeCommand);

                RffeCommand readCommand = new RffeExtendedRegisterReadCommand(slaveAddress, registerAddress, writeData.Length);
                readCommands.Add(readCommand);
            }

            // burst commands
            bus0.Burst(writeCommands);
            bus0.Burst(readCommands);

            // print results to console
            Console.WriteLine("Slave | Register | Write | Read");
            foreach (var commands in Enumerable.Zip(writeCommands, readCommands, (writeCommand, readCommand) => (writeCommand, readCommand)))
            {
                var    writeCommand       = (RffeExtendedRegisterWriteCommand)commands.writeCommand;
                var    readCommand        = (RffeExtendedRegisterReadCommand)commands.readCommand;
                string formattedWriteData = '[' + string.Join(",", writeCommand.RegisterData.Select(val => string.Format("0x{0:X2}", val))) + ']';
                string formattedReadData  = '[' + string.Join(",", readCommand.RegisterData.Select(val => string.Format("0x{0:X2}", val))) + ']';
                Console.WriteLine(string.Format("0x{0:X2} | 0x{1:X2} | {2:s} | {3:s}", writeCommand.slaveAddress, writeCommand.registerAddress, formattedWriteData, formattedReadData));
            }

            // wait on user
            Console.WriteLine("Burst complete. Press any key to exit..");
            Console.ReadKey();

            // disable bus and close session
            bus0.DisableVIO();
            session.Close();
        }
        public static void ConfigureAndSourcePin(NIDigital nIDigital, SourcePinConfiguration sourceConfig)
        {
            DigitalPinSet pinSet = nIDigital.PinAndChannelMap.GetPinSet(sourceConfig.PinName);

            pinSet.Ppmu.OutputFunction = sourceConfig.PinOutputFunction;
            switch (sourceConfig.PinOutputFunction)
            {
            case PpmuOutputFunction.DCCurrent:
                pinSet.Ppmu.DCCurrent.CurrentLevel = sourceConfig.Current_A;
                break;

            case PpmuOutputFunction.DCVoltage:
                pinSet.Ppmu.DCVoltage.VoltageLevel = sourceConfig.Voltage_V;
                break;
            }
            pinSet.Ppmu.Source();
        }
示例#10
0
        static void Main()
        {
            NIDigital digital = new NIDigital("PXI1Slot2", false, false, "");

            string pinMapPath  = Path.GetFullPath(@"Support Files\PinMap.pinmap");
            string specPath    = Path.GetFullPath(@"Support Files\Specifications.specs");
            string levelsPath  = Path.GetFullPath(@"Support Files\PinLevels.digilevels");
            string timingPath  = Path.GetFullPath(@"Support Files\Timing.digitiming");
            string patternPath = Path.GetFullPath(@"Support Files\Pattern.digipat");

            ProjectFiles projectFiles = new ProjectFiles
            {
                PinMapFile          = pinMapPath,
                SpecificationsFiles = new string[1] {
                    specPath
                },
                PinLevelsFiles = new string[1] {
                    levelsPath
                },
                TimingFiles = new string[1] {
                    timingPath
                },
                DigitalPatternFiles = new string[1] {
                    patternPath
                }
            };

            LoadProjectFiles(digital, projectFiles);

            SourcePinConfiguration sourcePin = GetDefaultSourcePinConfiguration();

            sourcePin.PinName = "DUTPin1";

            ConfigureAndSourcePin(digital, sourcePin);

            TriggerConfiguration triggerConfig = new TriggerConfiguration
            {
                BurstTriggerType = TriggerType.None
            };

            InitiatePatternGeneration(digital, "new_pattern", triggerConfig);

            digital.PatternControl.Abort();

            DisconnectAndClose(digital);
        }
        public static void LoadProjectFiles(NIDigital nIDigital, ProjectFiles projectFiles)
        {
            if (string.IsNullOrEmpty(projectFiles.PinMapFile))
            {
                throw new ArgumentException("A pin map file is required by the instrument", "ProjectFiles.PinMapFile");
            }
            else
            {
                nIDigital.LoadPinMap(projectFiles.PinMapFile);
            }

            if (projectFiles.SpecificationsFiles.Length > 0)
            {
                nIDigital.LoadSpecifications(projectFiles.SpecificationsFiles);
            } //Specifications sheets are not required by the instrument

            if (projectFiles.PinLevelsFiles.Length > 0)
            {
                nIDigital.LoadLevels(projectFiles.PinLevelsFiles);
            }
            else
            {
                throw new ArgumentException("At least one levels sheet must be supplied to the instrument", "PinLevelsFiles");
            }

            if (projectFiles.TimingFiles.Length > 0)
            {
                nIDigital.LoadTiming(projectFiles.TimingFiles);
            }
            else
            {
                throw new ArgumentException("At least one timing sheet must be supplied to the instrument", "TimingFiles");
            }


            foreach (string path in projectFiles.DigitalPatternFiles)
            {
                nIDigital.LoadPattern(path);
            }

            if (projectFiles.PinLevelsFiles.Length == 1 && projectFiles.TimingFiles.Length == 1)
            {
                nIDigital.ApplyLevelsAndTiming("", projectFiles.PinLevelsFiles[0], projectFiles.TimingFiles[0]);
            }
        }
示例#12
0
        public static ReadData BurstRFFE(NIDigital niDigital, RegisterData regData, string pinName,
                                         RFFECommand rffeCommand, TriggerConfiguration triggerConfig)
        {
            //Check data is valid
            rffeCommand.ValidateLogic(regData);

            //Create source and capture waveforms in driver
            CreateRFFEWaveforms(niDigital, pinName, rffeCommand);

            //Create dynamic source waveform data for selected command
            rffeCommand.CreateSourceData(regData, out uint[] sourceData, out int byteCount);
            niDigital.SourceWaveforms.WriteBroadcast(rffeCommand.SourceName, sourceData);

            //reg0 set based on amount of bytes used
            niDigital.PatternControl.WriteSequencerRegister("reg0", byteCount);

            //Burst pattern based on the input trigger settings
            Digital.InitiatePatternGeneration(niDigital, rffeCommand.SourceName, triggerConfig);

            //On read calls only, return capture data
            return(new ReadData());
        }
示例#13
0
        public static void LoadDigitalProject(NIDigital session)
        {
            string assemblyPath            = Assembly.GetExecutingAssembly().Location;
            string assemblyDirectory       = Path.GetDirectoryName(assemblyPath);
            string digitalProjectDirectory = Path.Combine(assemblyDirectory, "digiproj");
            string pinMapPath = Path.Combine(digitalProjectDirectory, "PinMap.pinmap");

            session.LoadPinMap(pinMapPath);
            session.LoadSpecifications(Path.Combine(digitalProjectDirectory, "Specifications.specs"));
            string levelsPath = Path.Combine(digitalProjectDirectory, "PinLevels.digilevels");

            session.LoadLevels(levelsPath);
            string timingPath = Path.Combine(digitalProjectDirectory, "Timing.digitiming");

            session.LoadTiming(timingPath);
            session.ApplyLevelsAndTiming("", levelsPath, timingPath);
            string[] digitalPatternPaths = Directory.GetFiles(digitalProjectDirectory, "*.digipat");
            foreach (string path in digitalPatternPaths)
            {
                session.LoadPattern(path);
            }
        }
        public static void InitiatePatternGeneration(NIDigital nIDigital, string patternStartLabel, TriggerConfiguration triggerConfig)
        {
            switch (triggerConfig.BurstTriggerType)
            {
            case TriggerType.Software:
                nIDigital.Trigger.StartTrigger.Software.Configure();

                // This call to BurstPattern returns immediately because waitUntilDone is 'false.'
                nIDigital.PatternControl.BurstPattern(string.Empty, patternStartLabel, true, false, TimeSpan.FromSeconds(10));
                break;

            case TriggerType.DigitalEdge:
                nIDigital.Trigger.StartTrigger.DigitalEdge.Configure(triggerConfig.DigitalEdgeSource, triggerConfig.DigitalEdgeType);

                // This call to BurstPattern returns immediately because waitUntilDone is 'false.'
                nIDigital.PatternControl.BurstPattern("", patternStartLabel, true, false, TimeSpan.FromSeconds(10));
                break;

            case TriggerType.None:
                nIDigital.PatternControl.BurstPattern(string.Empty, patternStartLabel, true, TimeSpan.FromSeconds(10));
                break;
            }
        }
 public static void DisconnectAndClose(NIDigital nIDigital)
 {
     //Disconnect all pins before closing
     nIDigital.PinAndChannelMap.GetPinSet("").SelectedFunction = SelectedFunction.Disconnect;
     nIDigital.Close();
 }
示例#16
0
 protected virtual void WriteSourceWaveform(NIDigital session, uint[] waveformData)
 {
     session.SourceWaveforms.WriteBroadcast(Name, waveformData);
 }
示例#17
0
 protected override void WriteSourceWaveform(NIDigital session, uint[] waveformData)
 {
     base.WriteSourceWaveform(session, waveformData);
     session.PatternControl.WriteSequencerRegister("reg0", ByteCount);
 }
示例#18
0
 public MipiRffe(NIDigital session)
 {
     this.session = session;
 }
示例#19
0
 public MipiRffe(NIDigital session, int busNumber) : this(session)
 {
     this.busNumber = busNumber;
 }
        static void Main(string[] args)
        {
            #region Station Configuration
            string      sgName      = "VST2";
            string      digitalName = "PXIe-6570";
            DigitalMode desiredMode = DigitalMode.Digital_Enable;
            //To calculate this delay, use the TDR feature of the Digital Pattern Editor (DPE)
            //In the DPE, navigate to Instruments » TDR...
            double PFI0CableDelay_s = 11.4e-9;
            #endregion

            #region SG Configuration
            NIRfsg rfsgSession = new NIRfsg(sgName, false, false);

            InstrumentConfiguration instrConfig = new InstrumentConfiguration
            {
                ReferenceClockSource     = RfsgFrequencyReferenceSource.PxiClock,
                CarrierFrequency_Hz      = 2.402e9,
                DutAverageInputPower_dBm = 0,
                ShareLOSGToSA            = false,
            };

            ConfigureInstrument(rfsgSession, instrConfig);

            string waveformPath = Path.GetFullPath(@"TDMS Files\11AC_MCS8_40M.tdms");

            Waveform wave = LoadWaveformFromTDMS(waveformPath, "wave");
            DownloadWaveform(rfsgSession, wave);

            WaveformTimingConfiguration waveTiming = new WaveformTimingConfiguration
            {
                DutyCycle_Percent       = 20,
                PreBurstTime_s          = 2000e-9,
                PostBurstTime_s         = 500e-9,
                BurstStartTriggerExport = "PXI_Trig0"
            };
            PAENConfiguration paenConfig = new PAENConfiguration
            {
                PAEnableMode = PAENMode.Dynamic,
                PAEnableTriggerExportTerminal = "PFI0",
                PAEnableTriggerMode           = RfsgMarkerEventOutputBehaviour.Toggle,
            };

            switch (desiredMode)
            {
            case DigitalMode.RFFE_MIPI:
                //Calculate the command length by multiplying the number of vector cycles (18 for Reg0Write)
                //by the clock rate (currently 52 MHz)
                paenConfig.CommandEnableTime_s  = 18 * (1 / 52e6);
                paenConfig.CommandDisableTime_s = 18 * (1 / 52e6);
                break;

            case DigitalMode.Digital_Enable:
                //For the digital enable case, the command time can be considered to be 0 since the digital
                //line is simply being toggled high/low
                paenConfig.CommandDisableTime_s = 0;
                paenConfig.CommandEnableTime_s  = 0;
                break;
            }
            //Until NI-DIGITAL 19.0 is released, the triggering mechanism used is to trigger using the PFI line
            //and detecting the change with a match opcode. There are a total of 830 cycles of the instrument required
            //before the command is sent from the pattern. Hence, an 830ns delay is added to the command time to account
            //for this.
            paenConfig.CommandEnableTime_s  += 830e-9;
            paenConfig.CommandDisableTime_s += 830e-9;

            ConfigureBurstedGeneration(rfsgSession, wave, waveTiming, paenConfig, out _, out _);
            #endregion

            #region NI Digital Config
            NIDigital digital = new NIDigital(digitalName, false, false);

            ProjectFiles projectFiles = Digital.Utilities.SearchForProjectFiles(Path.GetFullPath(@"Dynamic Digital Control Project"), true);
            LoadProjectFiles(digital, projectFiles);

            ApplyPinTDROffset(digital, "PFI0", PFI0CableDelay_s);

            //Select the appropriate pattern based on the desired control mechanism
            switch (desiredMode)
            {
            case DigitalMode.Digital_Enable:
                digital.PatternControl.BurstPattern("", "Dynamic_Digital_Enable", true, false, TimeSpan.FromSeconds(10));
                break;

            case DigitalMode.RFFE_MIPI:
                digital.PatternControl.BurstPattern("", "Dynamic_RFFE_Control", true, false, TimeSpan.FromSeconds(10));
                break;
            }

            #endregion

            rfsgSession.Initiate();

            Console.WriteLine("Generation on the signal generator and digital pattern instrument has begun. Press any key to abort generation and exit the program.");
            Console.ReadKey();

            AbortGeneration(rfsgSession);

            digital.PatternControl.Abort();

            DisconnectAndClose(digital);
            rfsgSession.Close();
        }
示例#21
0
        protected virtual void CreateWaveforms(NIDigital session)
        {
            var pinSet = session.PinAndChannelMap.GetPinSet(pin);

            session.SourceWaveforms.CreateSerial(pinSet, Name, SourceDataMapping.Broadcast, 1, BitOrder.MostSignificantBitFirst);
        }