IF-RIO

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure the dac to interpolating mode?

Hi Jerry,
I want to Continually generate a new data. For this purpose I want to put the DMA fifo  inside the whileloop. Please help me.
I am awiting for your response.
Siddu
0 Kudos
Message 11 of 31
(4,984 Views)
Hi Siddu
 
Sorry, I had wanted to create an example showing what must be done, but current workload has kept me from getting the time to do so.
The basic issue is to create and transfer your waveform data from the host as fast as or faster than the data is consumed by the DAC on the NI 5640R module, or we get an underflow.  The best way to get the program running is to start out with a very slow generation /IQ rate and work out the kinks of the code itself.  This rate may actually be slower than the actual rate required.  (BTW, what IQ rate do you need for your application?)
 
Here are a few tips, instructions that you need to do.
 
Host side
1.  For the Host to Target/ni5640R DMA process, you should configure the DMA buffer on the host computer to be relatively large (especially if you are going to be running at a rate that taxes the PCI bus and other components of the system).  You can do this by using an Invoke Node on the DMA buffer and configuring it for a good size number.  For a 1 MSps IQ rate, 500,000 samples might be a good number to start with.  The important point is that you want to keep the host buffer with as much data as possible so that the NI5640R will always get data when it needs it.
 
2. When you start downloading waveform data to the DMS buffer, you should fill up the DMA buffer (and the buffer in the FPGA, more on that later) before the DAC actually starts generating.  We need to “prime” the system so to speak.  When the system is primed, then the host code must send a signal to the FPGA that the DAC should now start generating.
 
3. When downloading data while the DAC is generating, the process should be to check the available space periodically.  When the space is available to a write of data of a certain chunk size, then do the DMA write.  You can do this by writing an empty array of data size zero with a timeout of zero.  This will immediately return with a number indication how much space is available in the DMA buffer.  When the value is greater than your chunk size, write a new set of data to the DMA buffer.  The polling action should happen fairly quickly, at least quicker than trying to write a number of samples to the DMA buffer and finding out that there isn’t enough room.
 
Chunk Size:  Chunk size is system dependant.  Writing 1 sample of at a time to the DMA buffer will be really slow.  Writing extremely large arrays to the DMA buffer at one time will be slow as well.  Large arrays can be unwieldy in terms of the OS allocating space for the arrays and slow the process down as well.  A happy medium should be found, which is dependent on the amount of RAM on your computer, the type of processor, and any other applications that you may be trying to run at the same time.

FPGA:
1. There should be two loops, 1. The loop reading data from the DMA FIFO and passing data to a Local FIFO.  2. A loop reading the data from the Local FIFO and then to the DAC Write node.
 
The loop reading data from the DMA FIFO should run as fast as the fastest DAC IQ rate.  This loop can always run at this rate regardless of the rate you configure the DAC IQ rate.  If the DMA FIFO is empty, then there is no write to the Local FIFO, in this case, you are probably headed to an underflow state and starve the DAC of data pretty quickly.  If the Local FIFO is full and the new IQ sample from the DMA buffer can’t be written, on the next iteration of the loop, skip reading a new sample and try to rewrite the current sample to the Local FIFO.  Do this until there is room in the Local FIFO.
 
The DAC loop is simplye taking data out of the Local FIFO and sending it to the DAC. 
 
In each loop, you should create indicators which will signify whether the FIFOs have underflowed for an error condition.  If the Read DMA FIFO to Write Local FIFO loop is definitely running faster than the DAC loop, if the Read Local FIFO in the DAC loop will provide the best error location for an underflow.  When the Read Local FIFO is empty, an underflow has occurred and this should set a flag so that the Host program errors out.
 
The flags should be able to be reset.
 
The Local FIFO should also be as large as possible to ensure that the DAC has data. There might be some cases where the OS goes off and does something which prevents the transfer of data from the Host DMA buffer to the FPGA.  This will allow the DAC to have a reserve of data to generate until the process of transferring data to the FPGA resumes.  This is another reason that the Read DMA FIFO and Write Local FIFO loop should run twice as fast as the DAC loop so that if the Local FIFO starts running low, the system can refill it up faster than data is being consumed.  You can run the Read DMA FIFO loop off the RTSI clock running at 50 MHz.
 
These are the basics and should get you started.
 
Jerry
0 Kudos
Message 12 of 31
(4,976 Views)
Hi Jerry,
Thanks for your response. I wii try to implement that thing. I have some more queries on this card.
1. I want to have user programmable Decimationfactor of any value from 4 to 2048.
2. I would like to have the RSSI indication and AGC voltage.
3. How to control the AGC Time constant?
4. Whether 5640R card will support for subcarrier demodulation?
5. I request you to please suggest the appropriate DAQ card for producing the Two baseband outputs and one combined baseband output of the two. total of three outputs with the frequency of DC to 20MHz.
 
Please give me the solutions for these things. I am awiting for your response.
 
Thanks and regards
Siddu
0 Kudos
Message 13 of 31
(4,919 Views)
Hi Siddu
 
First, a comment about the module.  The module was implemented in such a way that there are features that are supported by National Instruments, and that for more advanced users, they would not be prevented from taking advantage of features that NI did not support in the ni5640R software.  Most of your questions fall in the second case.  My expertise falls more in terms of what is supported by National Instruments.  In the development of the module, the features of the module not supported by the ni5640R were not tested, and as such, have not been looked at in terms of anyone here knowing how to implement or support them.
 
1. The ni5640R software supports specific decimation factors.  This means that specific filters have been designed for these decimation factors.  These supported decimation factors are the ones found in the Decimation control of the “ni5640R ADC Configure DDC.vi”  No filters have been designed for the other decimation factors.  The NI 5640R specification does say that the hardware supports decimation values of 4 to 2048 and this is true as far as the hardware is concerned.  Advanced users can refer to the ADC data sheet, learn what is required and then create their own filters to take advantage of other decimation rates.  Once this is done, if you look in the ni5640R ADC Configure DDC.vi”, you can see how the configuration is easily added to the VI to support another decimation value.  The hard part is designing the filters.  I have added a VI that can be used to create the filters, but I am providing it as is.  I haven’t really looked at it, or figured out how to use it.
 
2/3.  At this time, I do not have any details on these features.
 
4. Can you provide more details on this?  Are you talking about a specific block of LV FPGA code that can be used for this purpose?
 
5.  The only modules we have in this frequency range are the National Instruments AWGs.  The NI 5421 100 MSps AWG and the NI 5441 100 MSps AWG with OSP.  The modules can be synchronized.  The two NI 5421s generating the I and Q waveforms, and the NI 5441 can generate the two I and Q waveforms through its digital up converter.  Although, I’m not sure what you mean by a combined baseband output.
 
Jerry
0 Kudos
Message 14 of 31
(4,901 Views)
Oops.  Here is the VI.
Download All
0 Kudos
Message 15 of 31
(4,896 Views)
Hi Siddu
 
I still don’t have an example showing how to do continuous generation.  But I realized I do have some code showing continuous acquisition.  Manny of the features in this program can and should be used in a generation program.  Unfortunately, while the code works, with varying max sample rates, they are not the typical fully annotated and documented examples.  I hope they can help you move in the right direction with as little missteps as possible.
 
There are 4 Host VIs in the project:
 
ni5640R Single CH Continuous Acquisition Ex (HOST).vi – Basic acquisition to the host.
 
ni5640R Single CH ContAcq to Disk (LV File IO) Ex (HOST).vi – This version saved the data to a file using the native LabVIEW File IO VIs.
 
ni5640R Single CH ContAcq to Disk (wIN32 File IO) Ex (HOST).vi – Same version as the previous, except the native LabVIEW File IO VIs have been replaced with custom VI that call directly to the Windows native file functions.  These file IO VIs are faster when saving data to a file.  Read the information on these VI in the link below before using them.
 
ni5640R Single CH ContAcq to Disk Queues (Win32 File IO) Ex (HOST).vi – Same as the previous version, but queues have been added to help with memory allocation.  This is the fastest version as most items that can be optimized have been optimized.
 
It seems the zip file is a little too large for the Forum to accept (5.14 MB).  You can download it from here:
ftp://ftp.ni.com/support/rf_segment/demos/ifrio/ContinuousAcq/
Filename: ni5640R Single CH Continuous Acquisition Ex
 
Stream to Disk Using Win32 File IO
http://zone.ni.com/devzone/cda/epd/p/id/5348
 
Jerry
0 Kudos
Message 16 of 31
(4,723 Views)
Hi Jerry,
Thanks a lot for your response. I have QPSK Demodulator code which was written in Labview8.2 using Fixed point math analysis. I dont have the FXP Math analysis for Labview 8.2, because of this I want to convert this code in to LV8.5. otherwise if you have that .exe file please send to me. I attached the code with this mail. Please help me.
 
What is the significance of ADC_0_AGC input port?
 
 
 
Thanks and regards
Siddu
0 Kudos
Message 17 of 31
(4,674 Views)
Hi Siddu
 
Where did you find term “ADC_0_AGC”?  I looked this morning and couldn’t find it in the project, or VIs.  I don’t know any more about the AGC that what is in the ADC part’s spec document.
 
Concerning your LV 8.2.1 VI, the following is in the ni5640R software readme file.  I’ll see if I have time today to convert the project to LV 8.5, but you get it faster if you try it first.
 
Jerry
 
Host VIs developed in LabVIEW 8.2.1 or previous versions will not run when initially opened in LabVIEW 8.5. To run the VI, first complete the following steps:
 
1. Ensure LabVIEW is closed, and then copy the folder <LabVIEW 8.5>\examples\instr\ni5640R\FPGA\ni5640R Template\NI-5640R VIs over your project folder of the same name.
2. Copy <LabVIEW 8.5>\examples\instr\ni5640R\FPGA\ni5640R Template\ni5640R Template.lvlib to your project folder.
3. Open the copied ni5640R Template.lvlib
4. Select Save As, then click Rename in the resulting dialog box.
5. Rename ni5640R Template.lvlib to match the name of the original library.
6. Close the Template.lvlib.
7. Open the project.
0 Kudos
Message 18 of 31
(4,666 Views)
Hi Jerry,
In the project menu under the section of input, there are four inputs for the every channel. they are
1. ADC_0_PORTA_I
2. ADC_0_PORTA_Q
3. ADC_0_PORTA_RSSI
4. ADC_0_PORTA_AGC

As per my knowledge,these are the IDATA, QDATA, Rssilevel, Agcvoltage. When I am putting the rssilevel and agc in the FPGA Input side I didnot find any value about these two ports.


In the case of QPSK Demodulator, in FPGA code Fixed point math analysis functions uare used. The FXP Math anlysis functions are somewhat differ from LV8.2.1 to LV8.5. That why I am getting problem in FPGA side. I dont have any problem in HOST side. Please help me.


thanks and regards
Siddu
0 Kudos
Message 19 of 31
(4,648 Views)
Hi Siddu
 
OK, I see what you mean about the AGC.  I’ve asked the other guy here if he has any more info this.  I’ll let you know if he knows anything.  I don’t have a clue at this point.
 
I also see what you mean about upgrading the VI.  Sorry, I thought your issue was upgrading the project from 8.2.1 to 8.5.  You issue is different versions of the Fixed Point Library.  Unfortunately, the project that you attached does use the initial version, basically an alpha or beta release, of the library that I think was working in LabVIEW 8.2.1 which was based on cluster wires.  The newer version uses the new fixed point data type that is in LabVIEW 8.5.  There is no simple method of upgrading the VIs.  They must be replaced one by one, ensuring that the properties are the same in terms of the integer math and the number of bits.
 
I haven’t seen this example before.  Where did you get it?
 
Jerry
0 Kudos
Message 20 of 31
(4,642 Views)