DMA FIFO number of elements to read mismatch in FPGA and RT

Hi all
I am using myRIO , LV14 to run my application.
Application: I have to continuously acquire data via FPGA and process in RT host once every 2000 samples are collected. I use DMA FIFO (size 8191) to acquire data, use timeout property at the FPGA to eliminate buffer overflow. I had followed cRIOdevguide to implement this part. A snippet of what I have implemented is attached. Whole code runs in SCTL at 50MHz.
Issue: Twice or thrice I encountered with this strange behaviour, that the FPGA FIFO is giving continous timeout and the RT is unable to read the FIFO. The number of elements to write propery in FPGA VI gives 0 showing that FIFO is full and no more can be written, but at the RT, elements remaining is giving 0, hence it is reading 0 (no) elements.
Workaround: I put a case where I will write to FIFO (as per the code) and if the number of elements to write is nonzero. It seems to work fine, as of now.
What confuses me is that my FPGA VI says that FIFO is full (FIFO number of elements to write = 0) and gives a timeout error, but RT VI says that number of elements remaining in FIFO is 0 and hence no data is read. Any idea why it is so? My FPGA and RT VIs continues to run, but with no data being acquired or read.
I saw this behaviour within minutes after running the code. Any idea as to why it is happening? I am trying to reproduce the behaviour and will update if i again encounter with it. Sorry, I cannot post my code here, but i guess the code snippets explain it to some extend.
Thanks
Arya
Edit: Even with the mentioned workaround, the problem persists, now that the FPGA does not write to FIFO at all. And the RT VI is not able to read any elements as it sees 0 elements in the FIFO. The FIFO continues to be in timeout state. So i guess the problem is with the RT side.
Solved!
Go to Solution.
Attachments:
cRIOdevguide_FIFOreadwrite.PNG ‏107 KB
FPGA_FIFO_write.PNG ‏41 KB
RT_FIFO_read.PNG ‏39 KB

Hi Nathan
Yes, I could have replaced it with an OR. Regarding my application, I want to acquire data in chunks of 2000 samples. If at all I receive a timeout error, I want to discard that chunk of 2k samples and start all over again. So my logic was like this, I acquire the data, if there is a timeout, the reset is triggered, and the system waits to comeback from reset, and it starts acquiring again. Btw, I tried removing the multiple FIFO reads in RT, but the error is still the same.
I have a small doubt as well, if I do not want to obtain stale data at alI, I would just check if timeout occurs, empty my FIFO and start acquiring data again (no reset button), isnt it? This was my original logic, but I saw that after a while, it stopped acquiring data and timeout led was on. I was thinking that FPGA and RT was simultaneously trying to acquire FIFO which might cause timeout. Somehow, I now feel that, as you have pointed out, my code is overly complicated. I will modify it and update the results. Thank you!
Arya

Similar Messages

  • Query related Internal buffer storage in PXi 7965R DMA FIFO ?

    Hello,
    I am establishing a communcation from HOST to FPGA by using DMA-FIFO. Maximum size for this FIFO is 1024. Now from the host side, I am writing a data of 1-D array (Unsinged 64bit integer) into the fifo, and from FPGA side, this data is being read from the fifo. Now as i  start the simluation, the default value of "Empty elements remaining" shows "10,000". further as the elements inside the fifo starts getting to read (at FPGA side), the "Number of elements to read" increases and when it reaches the value of 1024, then the "empty elements remaining" starts decreasing. The behaviour is described in the image (atteached).
    while observing this behaviour of the FIFO, i discovered that this DMA FIFO, (having max. storage elements of 1024) also has an (additional) internal storage space of 10,000 elements. I might call it as internal buffer of this FIFO. now my question here is that, where are these (10,000 elements) values stored ?. as it is from HOST side, so is it the CPU storage ? or what ?
    Thanks
    Anum Sheraz

    ok so I got my answer, its actually the default depth of the DMA FIFO. 
    Maximum size of this FIFO is set to be 1023, which is coerced to a value of 1029. I did a mistake in the picture (posted in last msg), Here is the correct one; 
    I've corrected the some of the figures. by noticing its behaviour, when the number of elements to read reaches 1027, then the remaining elementes starts decreasing from value of 10,000. and it reaches to max value of 11027 when remaining elements=0. I am confused with this figure "1027" !!! . why is this 1027 ? 
    as I have assigned maximum size of this FIFO to be 1023, which is coerced to a value of 1029, so Shouldn't it be 1029 ?.  

  • CRIO DMA FIFO transfer Issue-Voltage not coming to correct channels

    Hi All,
    Using crio 9073 and NI 9205, I am transferring Data (Channel data type = FXP, Word length 37 bits, 16 bits and FIFO also same data type) from FPGA DMA (Requested No of elements configured in FPGA is 16383) To RT DMA (Requested number of elements in 32744)
    FPGA notes:
    Total channels =16 (Differential mode)
    Loop time of FPGA =20 ms (Per read 20 samples from each channel, so 320 samples per iteration)
    RT notes:
    SCTL=running at 10 ms where DMA transfer happening do that check remaining elements and then do DMA as well.
    Issue:
    When I run the code in above scenario, whatever different voltages given to 4 channels (loop backed 9263 to 9205, fpga interactive mode and only giving 4 channels voltages now just for testing) and i do DMA in RT side, decimate the 320 data and i found Channel 0 voltage given in FPGA is not coming in 0 index of the decimated array in RT DMA read data, instead Channel 0 voltage is coming in Index 7 of the RT DMA read data.  Channel 1 coming at index 8...vice versa… Seems, some data shifting happening.
    But in FPGA i could see correct differential voltage coming to correct channels (Ch 0 is 1.4 V ,FPGA indicator shows me correct voltage at index 0 a 1.4 and vice versa)..
    Please suggest me why this is happening and what is best way i can get correct channel voltage data in RT based on my above conditions.

    This is how I do where I need to only measure continuos analog values through FIFO. I don't use calibrated analog channel. I use raw analog channel and do calibration in host VI. I have attached screenshot of my code. I put 123456789 check sequence in build array function in FPGA VI.
    If I want to read 2000 samples then I keep FIFO 4000 at host side.
    I keep sample count in multiple of no. of channel. In my code build array has 3 element so I read 3*X. where X number of sample required per channel.
    If you don't understand from code let me know.
    PBP (CLAD)
    Labview 6.1 - 2014
    KUDOS ARE WELCOMED.
    If your problem get solved then mark as solution.
    Attachments:
    FPGA VI.jpg ‏205 KB
    FPGA 2.png ‏92 KB
    Host VI.jpg ‏168 KB

  • How can i decide the depth of all3 DMA fifo's are used as target to host at RT contoller side(host)?

    Hello,
          I am using all DMA fifos,I want to acquire data from 3 AI modules upto 50 khz frequency.Sampling rate can be varied according to application.
       please suggest me how should i allocate memory of my RT controller for those DMA fifos?I am also facing one problem, I am using 3 time deterministic loop with different different priorities,each time loop has one fifo where data is reading with polling method(first fifo.read=0 then againg fifo.read=remaining elements).and each time loop has been interact to host vi with global varibales.those global variables data update from normal time loop.can anybody suggest that this procedure is right or not.if my problem is not much clear i will again explaing my query with snapshot of my application.
    Pratima
    *****************Certified LabView Associate Developer****************************

    You wouldnt need to allocate memory separately on your RT Controller for the FIFOs. You need to create a FIFO under your FPGA target and use the FPGA interface VIs in your RT VI to access the DMA FIFO. You would need to use the FPGA interface invoke method VI to access your DMA FIFO.
    As for the other questions, I would recommend you to create a separate post the RT section of LabVIEW so that you can get a faster response to your questions.
    I hope this helps!
    Mehak D.

  • Number of elements in target to host DMA FIFO

    Hi everyone,
    I'd like to transfer a set of datapoints from a FPGA to a RT-host controller using a DMA fifo. If I use the "Get Number of Elements to Write" function on the FPGA target, do I get the total number of elements in both buffers, or just the one on the FPGA-target?
    (see http://zone.ni.com/reference/en-XX/help/371599H-01​/lvfpgaconcepts/fpga_dma_how_it_works/)
    Solved!
    Go to Solution.

    What type of data do you want to transfer over the FIFO? As in how many bits does each sample contain.
    The reason I ask is because you can take a bit packing approach.
    Lets take for example you want to take two samples of a measerment both samples are 32 bit and then send the data as a set to the processor.
    If you just dump the data into a single FIFO you may lose track as to what was the rising edge, or falling edge data, or if the two samples you got from the FIFO are even from the same dataset.
    To fix this use bit packing technique.
    On the FPGA merge your two 32 bit data sets into one 64bit dataset. 
    Set your FIFO to 64 bits.
    On the processor side of things all you need to do is read one 64bit dataset from the FIFO.
    Use the split data to break the 64bit into two 32bit data fields. 
    Now you have your two data samples, and you can be garentee that it is from the same dataset.
    If the sum of the data bits exceed 64 bits (the limit of the FPGA FIFO) then you will need to migrate to a more complex bit packing data schema where the data is split up among multiple 64bit datafields, with a defined bitfield header and identifier. For example the first 5 bits of the 64bit data identifies that this data block is 1 out of X data blocks, that when combinded together and reasembeled per the schema will represent your data..
    I hope this helps.

  • How to decide the maximum number of elements for DMA FIFO in R series FPGA

    Greetings!
    I'm working on a project with NI R series PCIe-7842R FPGA board. To achieve fast data transfer I'm using target-to-host DMA FIFO. And to minimize the overhead, I'd like to make the FIFO size as large as possible. According to the manual, 7842R has 1728 kb (216KB) embedded block RAM, i.e., 108,000 I16 type FIFO elements available in theory (1728,000/16). However the FPGA had compilation error when I requested such amount of elements. I checked the manual and searched online but couldn't find the reason. Can anyone please explain? And in general, what's the max FIFO size given the size of the block RAM?
    Thanks! 

    Hey iron_curtain,
    You are correct that moving larger blocks of data can lead to more efficient utilization of the bus, but that's almost certainly not the most important factor here. Assuming of course that the FIFO on the FPGA is big enough to avoid overflows, I'd expect the dominant factor to be the size of read performed on the host. In general, larger reads on the host lead to improved throughput, up to the speed of the bus. This is because FIFO.Read is a relatively expensive software operation, so it's advantageous to make fewer calls to get the same amount of data.
    Note that the larger your call to FIFO.Read the larger the host buffer needs to be. Depending on your application, it might need to be several times larger than the read size. You can set the buffer size with the FIFO.Configure node.
    http://zone.ni.com/reference/en-XX/help/371599H-01/lvfpgaconcepts/fpga_dma_how_it_works/ explains the various buffers involved. It's important to note that the DMA Engine moves data asynchronously from the read/write nodes on the host and fpga.
    Let me know if you have any questions about any of this.
    Sebastian

  • How to check number of elements available in RT FIFO?

    Hi,
        Without using READ FIFO function is there a way to check the number of elements in RT FIFO? I am looking a function like the get queue status function VI.
        Thanks a lot!
        Regards,
        Tom
    Solved!
    Go to Solution.

    RT FIFO Read and Write functions have had a "# elements" output since LabVIEW 8.2.  You should be able to utilize that output to determine how many elements are left in the FIFO.  If you have a version of LabVIEW previous to LabVIEW 8.2, you can utilize the attached VI to determine how many elements are left.
    Regards,
    Keith M.
    Applications Engineer
    Attachments:
    fifo.vi ‏65 KB

  • Reading DMA FIFO using Invoke method node

    Hi
    I am trying to read a DMA FIFO using invoke method node to read the data in the FIFO on RT.
    It works fine but the problem is that it consumes a lot of CPU if the timeout is increased. Can
    anyone tell why this is happening and if this is the desired behaviour then what other methods i can
    use to avert this.
    Please help at the earliest
    Regards
    Amit

    Hi
    Can anybody help me as it is urgent ,
    What i further found out is that is that it is eating up a lot of meory when continuosly polled up in a looop....
    Regards
    Amit Ahuja

  • Passing data from RT host to FPGA through DMA FIFO

    Hello,
    I am trying to write some data from an RT host to FPGA target using DMA FIFO then process this data and then read them back from the FPGA target to the RT host through another DMA FIFO. I am working on NI PXIe chassis 1062Q, with NI PXIe-8130 embedded RT controller and NI PXIe-7965R FPGA target.
    The problem I am facing is that I want to send three different arrays, two of the same size and the third one with different size, and I need the smaller one to be sent to the FPGA first. I tried using flat sequece with two frames in the FPGA VI. In the first frame I read and write the first array in a while loop which is finite (i.e., finite number of iterations). The second frame contains the process of reading and writing the second two arrays (of the same size) in a while loop that can be finite or infinite (according to a control). The problem is that this didn't work. The 2 arrays are displayed on the front panel of the RT host VI and are working fine, however, the array that should have been read in the first sequence doesn't show up on the front panel of the RT host VI. This doesn't make sense because if it is not passed from the host to the fpga and vice versa then the second frame shouldn't have been executed. Note that I am wiring (-1) to the timeout to block the while loop iterations till the passing of each element is complete. Thus the first while loop has 3 iterations only. Could someone help me undersdtand why this happens and how to solve this problem?
    I am attaching a picture of both the host and the fpga vi.
    Thank you.
    Solved!
    Go to Solution.
    Attachments:
    RT host vi.png ‏102 KB
    FPGA vi.png ‏28 KB

    No need to initalize the arrays with values that you will immediately overwrite.  Here's what I believe to be equivalent code:
    The array outputs should be wired directly to the FPGA FIFO writes.  Do not use local variables when you can wire directly.
    If you know that you want to transfer the Temp Data Array first, why not make your code do that?  Eliminate the sequence structure, and put the functions in the order in which you want them to execute.  Use the FPGA reference and error wires to enforce that order.  You might consider writing the Temp Data Array, reading it back, then writing the Real and Imag A arrays, to see if that gets you the results you expect.  Run the code in simulation (in the project, right-click on the FPGA target and execute on the host with simulated IO) so that you can use execution highlighting and probes to see what is happening.  Wire the error wires through and see if you get an error anywhere.  Make sure you're not missing something simple like looking at the wrong starting array index.

  • DMA FIFO

    Hi,
    I am writing 400 elements to a DMA FIFO of the NI7831 FPGA Target,  the DMA FIFO depth was defined in the FPGA FIFO Properties to 127 elements.
    The FPGA Target is running in emulation mode.
    No DMA read routine at Host side is running.
    So, I was waiting for the FIFO Full Flag but it never rise.
    Is there a failure in the write routine or do I something wrong ?
    Peter

    The full flag will never be set in emulation mode.  Data is not actually transferred into the DMA FIFO until the DMA engine starts.  The DMA engine starts using the Host VI.  So without a host interface VI to start the DMA engine, data is never going into the DMA FIFO.
    Regards,
    Joseph D.
    National Instruments

  • How to get the number of elements in a tilelist

    I'm writing test cases for a flex application using FlexSelenium and I need to get the number of elements displayed in the tilelist.
    I know that that the tilelist is fed by an array. but i can't access that array from my test case.
    Can anyone tell me how I can get the number of elements in a tilelist on the application? which property of the tilelist can provide that number?

    try tileList.dataProvider.length;

  • Number of elements at logical level / odbc driver

    Hi everyone,
    I'm new in BI area and I cannot understand one basic thing.
    I study documentation about BI server, exactly chapter about "creating dimensions" and I'm confused about setting "number of elements at logical level"
    It looks for me that "number of elements at logical level" is static.
    What will be when someone update data in the table and number of elements will be different than number of elements in our logical level?
    example:
    current column with distinct values:
    channel_desc:
    direct sales
    tele sales
    catalog
    internet
    partners
    in this case I set number of elements at logical level 5.
    after a while some update data in the table and our column looks (see below)
    column after update with distinct values:
    channel_desc:
    direct sales
    tele sales
    catalog
    internet
    partners
    others (added value)
    Does it mean that I have to change it to current numbers of elements?
    I'm sure that this is misunderstanding in my case, but I don't know where?
    Second problem which I have:
    BI with oracle database is on linux
    client software on windows
    I can import data from database like sybase or flat files to the physical model, I can view data, but when I create whole model (physical, bussines model and mapping, presentation) and I try access data from "Answers" I have this error:
    "Data source name not found and no default driver specified"
    regards
    Bart

    Number of elements is just an indication used by the BI Server (e.g. when generating LOV's in Answers). It won't cause any problems when it doesn't hold the exact number of elements available in the dataset.

  • Write two functions to find the the number of elements in a linked list?

    I am trying to Write two functions to find the the number of elements in a linked list. One method using recursion and One method using a loop...
    //The linked List class is Represented here.
    public class lp {
    public int first;
    public lp rest;
    public lp(int first1, lp rest1)
    first = first1;
    rest = rest1;
    The program i wrote so far is
    import java.util.*;
    import linklist.lp;
    public class listCount{
    //loop function
    public static void show_list(lp list)
    int counter = 0;
    while(list != null)
    list = list.rest;
    counter++;
    System.out.println ("length computed with a loop:" + counter);
    //recursive function
    public static int recursive_count(lp list)
    if (list.first == null)
    return 0;
    else
    return recursive_count(list.rest) + 1;
    //main method
    public static void main (String args[])
    lp list1 = new lp(1, new lp(2, new lp(3, null)));
    show_list(list1);
    System.out.println("length computed with a recursion:" +
    recursive_count(list1));
    at the if (list.first == null) line i get the error " incomparable types:
    int and <nulltype>" I know this is a beginners error but please
    help...What should I do?

    byte, char, short, int, long, float, double, and boolean are primitives, not objects. They have no members, you cannot call methods on them, and they cannot be set to or compared with null.

  • REST to SOAP: Invalid number of elements in URL "/"

    Hi,
    So having read the great blog series PI Rest Adapter - Don't be afraid by Alexander Bundschuh and I decided to try and set up my first scenario using the REST adapter in the same vain as Working with REST Adapter: A REST to SOAP Scenario in SAP PI/PO .
    When I come to test the service from SOAPUI I get a 404 error with the message "Invalid number of elements in URL "/". 3 expected, 0 received."
    As you can see it is hitting the correct sender communication channel as the response comes back with the channel name "RESTSenderMyService".
    The Channel has been set up as follows:
    Input and output format = XML
    Channel selection = MyService   (The 'Specify Endpoint' flag is ticked)
    There is no limit set for the HTTP operation.
    Everything else is left unchanged....left as their default values
    Also I've tried adding the full URL in SOAPUI in the endpoint field - the attached screenshot shows when I tried moving the /RESTAdapter/MyService into the Resource field.
    I've also fiddled with the media type of the payload from text/xml to application/xml.
    So the mystery is what does the error message refer to and what are the 3 elements it's expecting?
    Thanks in advance.

    Hi Peter,
    This has happened because you have not defined the values for the url pattern you have defined in the REST sender channel (I am talking about Service resource and id).
    Provide them in the resource section and you will get the message through.
    eg- /RESTAdapter/MyService/service/resource/id
    Thanks,
    Vikas Singh

  • Number of elements in the FP affecting the performance of my application ?

    I developed a simple application which consists of aquiring a signal through a channel of a PXI 5102 module and commanding some relays of a SCXI 1161 module.
    This application has the following features :
    -The user can, at any time, change the configuration of the PXI 5102 module.
    -The signal acquired can be saved to a file whenever the user wants.
    -Instead of showing the signal acquired through the PXI 5102 channel, the user can load a given file which contains a saved signal.
    -The user can increase or decrease the pressure on a line through a VI that commands SCXI 1161 relays.
    As you can see, it is a fairly simple application but the problem is that it have been running for a time the fron
    t panel crashes. Is it because the high number of elements I have in the front panel ?
    To give you more information I tell you that the processes of saving, loading, decreasing and increasing the pressure on the line are event cases of an event structure.
    The front panel consists of a tab structure, 20 controls and indicators and a cluster consisting of 9 controls.

    No error take place. By crashing I mean that after a period of time the frontpanel control´s response to inputs of the user become so slow that after a short time there´s no response at all.
    The problem is that I´ve been dealing with this problem in this aplication for quite a while and although I´ve optimized, I think, its execution time and the way it deals with memory usage this problem persists.
    Since most of the operations performed by it depends on inputs by the user I´ve decided to use an event structure to manage them and decided to load the VIs related to them dynamically into memory to somewoh optimize memory usage.
    In order to make things more clear to you I´m sending you a zipped file containing pics that completely describe the frontpane
    l ad the block diagram of the appliction.
    Any help you can give will be deeply appreciated.
    PS : I´ve tried to sent the zipped file but awindow appeared notifying me that Developer Exchange is down for maintenance. If you need any more information to clarify what I mean please let me know.
    Sincerely,
    Giovani Marcelino Nesi
    DRV Desenvolvimento e Representação Virtual Ltda.

Maybe you are looking for

  • Idocs knowledge for SAP MM   consultant

    Let me know what level of Idocs knowledge is required  for a SAP MM  consultant

  • Reinstalling OSX to new drive

    I recently received a brand new shiny Mac Pro (thanks to AppleCare) after my G5 went belly up. It came with only one 500GB drive and 1GB of memory. I upgraded to a total of 5GB of memory and put in 3 additional 500GB drives. 1 WD SE16 for backup of m

  • Related to production order costing

    Hello guys,   Will you guys help me in understanding the following query?        Suppose i am creating the production order for finished material of qty 20, and for which i require 20 semifinished material which i have mentioned in Bom of finished ma

  • I can't pay for by my account

    I want cancle my card in my payment, but its show me contact itunes support to complest this transaction.

  • Adjustments Won't 'Stick'

    Anyone ever come across the following : PSE3 on Mac 10.5.6 Scanned b/w image Layer New via copy Blend Mode - any mode Flatten image Result - image goes back to unblended state. Same problem with contrast adjustments etc. I have reset the preferences/