12-06-2010 04:41 PM
I've noticed in the following NI 5641R examples that they come with their own "NI-5640R VIs" directories, yet the 5640R driver download (http://ftp.ni.com/support/softlib/RF/NI-5640R/1.4/) also installs these functions in "C:\Program Files\National Instruments\LabVIEW 2009\instr.lib\ni5640R\Driver PXIe-5641R\Template\NI-5640R VIs" directory.
RT Spectrum Analyzer Example: http://zone.ni.com/devzone/cda/epd/p/id/6359
NI PXIe-5641R RIO IF Transceiver Example: http://zone.ni.com/devzone/cda/epd/p/id/6196
When I open either example I get a broken 'fpga reference' from the VI Open Reference function to the first 5640R function call (Configure Timebase in both examples), which seems because both examples use a subvi's without a binded typedef for the fpga reference. The broken link can be fixed by stepping through the "NI-5640R VIs" and replacing the 'fpga reference' with one I've defined for my target (ref: http://digital.ni.com/public.nsf/allkb/2906287B989006EA862576AB005BE08E). Yet it would seem to do this properly for my own project, I would need a copy of the "NI 5640R VIs" directory for my project. Correct? Why do the examples not have a control defined which can be updated in one place?
I see in the "NI IF Transceiver Getting Started Guide" page 20 it says to start the project by copying the 'template directory' which includes the "NI 5640R VIs" directory.
So, it would seem that this is in fact the correct way to address this issue? And the correct use of the 'NI 5640R VIs' ? Why are these functions different than the other driver functions (e.g. ni5640R Configure Acquisition)? What is the recommendation for setting up a project that uses these functions? How are updates handled (with the driver roll outs in which I have to update my project fpga references)?
Thanks,
Stu E.
12-07-2010 03:32 PM
Hey Stu,
You have a number of questions, and I will try to answer all of them, but I think it might be clearest if I just explain the whole situation. Forgive my verbose response, but I want to make sure you have your questions completely answered. The answers to your questions somewhat depend on the version of LabVIEW that you are using because of some improvements that we made in LabVIEW 2010 (and later versions).
If you are using LabVIEW 2009 (or older):
Typically the reason why you see the broken wire between the "Open FPGA VI Reference" and the first template VI is because of a mismatch in the bitfile path in the two nodes. This can occur when VIs or projects are moved, or if they are installed to a different path from which they were last located (or a few other reasons). For example, copying the template stack ("NI-5640R VIs") to a new location can cause this to happen. However, there is a much simpler way to repair your project than opening up all of the host VIs and replacing controls. In the configuration dialog for the Open FPGA VI Reference, there is a checkbox and path to "Bind FPGA host reference to type definition". All of the template VIs controls have already been bound to this single typedef and can be updated with one simple step. Check the checkbox and browse to the "NI-5640R VIs" directory in the specific project you are working on. In that directory you should see "ni5640R FPGA VI Reference.ctl". Make sure you are pointing to the right copy of the control on your system or you will overwrite one associated with another project and break the other project instead. Select this control, then click OK in the configuration dialog for the Open FPGA VI Reference. When you do this, LabVIEW will go to all instances bound to this typedef and update them with the new bitfile path (which you saw in the configuration dialog). The updating can take anywhere from 10 seconds to a couple minutes if you have a really slow/old system.
If the bind to typedef doesn't work, there are a few common mistakes that you might watch out for.
1) Make sure your "ni5640R FPGA VI Reference.ctl" is not marked read-only. This would prevent LabVIEW from making necessary edits. This is usually easy to spot by opening up the configuration dialog for the Open FPGA VI Reference and checking the path field under the bind to typedef checkbox. If the path is blank and you do not see the path that you just entered, then the read-only property is usually the culprit. Change the property in windows explorer and repeat the bind to typedef process.
2) The second most common mistake is selecting the wrong copy of "ni5640R FPGA VI Reference.ctl". Because the NI-5640R driver installs support for both the NI PCI-5640R and the NI PXIe-5641R (as of my writing this), there are a lot of copies of this control around your system. Make sure you select the correct instance of this control, which is the copy that sits in the same directory as the template VIs that are being used in your project. Opening one of these VIs (the Configure Timebase for instance) and selecting File>>Properties should tell you the path where the VI is located.
3) Another mistake that I have seen in the past is people trying to use the same set of template files for multiple different projects. When using LabVIEW 2009 or older, each project should have its own copy of the template VIs.
Also, it is strongly suggested that if you create any of your own SubVIs that have FPGA Host Interface controls and indicators, those controls and indicators should be bound to the same "ni5640R FPGA VI Reference.ctl". This will ensure an easy upgrade/conversion should you ever need to modify the control/indicator bitfile information in the future.
LabVIEW 2010 and the NI-5640R 1.5 driver (and later) contains a cool new feature that makes this process no longer necessary.
If you are using LabVIEW 2010 (or newer):
In the past, the reason why you saw the broken wire between the "Open FPGA VI Reference" and the first template VI was because of a mismatch in the bitfile path in the two nodes. The NI-5640R 1.5 driver makes use of a new feature in LabVIEW FPGA 2010 called the "Dynamic Host Interface" that makes this no longer an issue. When you use the Dynamic mode in the Open FPGA VI Reference node with Dynamic Host Interface controls and indicators, you are no longer requiring that the downstream nodes (controls, indicators, subVIs) have any specific information about the bitfile. They instead contain only an interface of controls, indicators, FIFOs, etc. As long as the wire coming into these nodes contains the necessary elements, the wire will be unbroken. As opposed to having a separate copy of the template stack for every project (like in the past) there is a single copy located at “<LabVIEW folder>\instr.lib\ni5640R\Configuration\ni5640R Template.lvlib” that has been converted to the dynamic host interface.
Detailed instructions for converting an existing (traditional host
interface) project to dynamic mode can be found in the help for the NI-5640R
1.5 driver (NI IF Transceivers Help). Try searching the help for “upgrade”. The quickest way to find the help file is to go to Start>>All Programs>>National Instruments>>NI-5640R>>Documentation.
If you do not want to convert your existing project to the Dynamic Host Interface, but you still want to get the latest bug fixes and features, a copy of the template that uses the traditional interface is located at “<LabVIEW folder>\examples\instr\ni5640R\FPGA\Traditional Configuration” for your convenience. This ni5640R Template.lvlib and the NI-5640R VIs subfolder can be copied into your project.
Note: The Dynamic Host Interface eliminates the need to bind the Open FPGA VI Reference to the "ni5640R FPGA VI Reference.ctl" typedef. It is however suggested that if you create any of your own SubVIs that have FPGA Host Interface controls and indicators, those controls and indicators should be bound to your own typedef. This will make things simple should you ever need to modify the control/indicator interface information in the future.
Note: You cannot mix Traditional FPGA Host Interface nodes with Dynamic Host Interface nodes. For a specific Open FPGA VI Reference Node, all of the downstream nodes that take in the interface wire must match the type of the open reference node.
If I have not answered any of your questions feel free to post back.
-Dan
12-07-2010 03:35 PM
Following the Instructions in the Getting Started Guide, page 20, for using the template. When I copy the Entire Template Directory to a new folder and open the project, the Files tab shows duplicate files. Fortunately it appears that the subvi's in the Host / Fpga are pointing to the copy that I've just made (verified by opening the Host, then a subvi & attempting to Save As). It also looks like the Template is using a typedef to bind the FPGA Reference so the Fpga reference doesn't break, so starting from the template vs. the examples appears like a better approach.
I have a few additional questions:
How do I correct the duplicate files or do I need to worry about it? Labview seems to show a warning (See attached image).
I then pulled in some simple test code which runs in simulation mode just fine and it looks like I will be able to call the 5640R functions (such as Configure Timebase), however when I try to call "ni5640R Configure Timebase" my program crashes. Do these functions only work on the hardware & not simulated? Or is there some additional setup for them to work in simulated mode.
Can you provide some clarification on what the FPGA Configuration Timed Loop in the Template is used for? Does it replace / conflict with a ADC template configuration call?
Thanks,
Stu E.
12-07-2010 03:45 PM
Stu, I don't think the attachment took. Could you post it again? Thanks.
12-07-2010 03:55 PM
Dan,
I'm using 2009 SP1 and 5640R 1.4. Thanks, verbose is good! I believe that addresses the broken link problem. I believe I ended up doing the same thing, but in a different / round-about way. I went back and started with the template directory that was installed with the driver as opposed to the "NI 5641R VIs" directory that came with the examples. It looks like the template directory that comes with the driver has the control typedef already defined, which results in a 'red-dot' and not a broken link, then changing it to point to a bitfile and then back to the VI resets the reference and it looks ok.
I think the only thing that you didn't address, which is really more just my curiosity, but "Why do these functions (e.g. Configure Timebase) need a separate instance which is essentially modified for each project?
Thanks again!
Stu E.
12-07-2010 03:56 PM
Oops.. here's the attachment. Stu E.
12-07-2010 04:42 PM
Ok, I think I see what is going on. The reason you are seeing all of the duplicate VI's probably has something to do with the fact that you copied the template from instr.lib as opposed to copying it from the example template located at "<LabVIEW Folder>\examples\instr\ni5640R\FPGA\<your target>\ni5640R Template\". The copy of the template is a special version that is meant to be used with the instrument driver only. You should always use the one that comes in the examples section.
As for why you must have a separate copy of the template and the typedef for each project: It is a limitation of using absolute paths in the FPGA host interface controls/indicators of subVIs (the path to the bitfile). Essentially the host controls and indicators need to have the path to the bitfile so they know what IO they can access. If you only had a single instance, every time you wanted to change the bitfile, it would break every other project using those VIs. This complexity has been eliminated by a really cool feature in LabVIEW FPGA 2010 that the NI-5640R 1.5 Driver makes use of (Dynamic Host Interface Mode).
As for the question of the emulation mode from your previous post, emulation mode is not currently supported when using the template lvlib. There isn't a limitation of the target itself that prevents you from using emulation mode, but the template contains code that cannot be run in emulation mode.
Hope that helps.
-Dan
12-07-2010 10:24 PM
Dan, Thanks! Makes sense. Glad I'm not trying to simulate something that can be simulated. I appreciate the detailed responses and quick replies! Very much appreciated.
Stu E.