nishad Posted July 22, 2010 Report Share Posted July 22, 2010 FDAQRT.viHey All I am working with a cRIO-9004. I wrote an FPGA VI to acquire data at different rates in parallel loops. The WSS-RPM loop samples 3 sets of data at 1500Hz while the Acc loop samples 5sets of data at 100HZ each. For each loop I am transferring the values to RT using DMA FIFO and generating a separate interrupt. For the RT program, I wrote code where RT waits for interrupt no 1 then reads the values from the DMA FIFO and acknowledges the interrupt then the same procedure is followed with the other interrupt. I am logging the data read from the FIFO to a tdms file and observed that I am losing some data. I fiddled around with the no of elements to be read from the FIFO on the RT side and got varying degrees of loss. Is this because the RT VI is executing strictly in parallel and hence always services interrupt 1 first, then zero hence leading to data loss?? Also this means that the interrupts from the FPGA aren't really working like interrupts but the situation is sort of similar to polling. I am not able to rectify this problem and I would be grateful if you could help me with the same. I know I need to change the code in my RT VI but dont know how to go about it.FDAQFPGA.vi I am attaching both the FPGA VI and the RT VI so that you can clearly understand the problem. Quote Link to comment
PaulL Posted July 22, 2010 Report Share Posted July 22, 2010 Are you able to do a real-time execution trace? You should be able to confirm or deny the theories you propose with the information from a trace. Quote Link to comment
ned Posted July 22, 2010 Report Share Posted July 22, 2010 For the RT program, I wrote code where RT waits for interrupt no 1 then reads the values from the DMA FIFO and acknowledges the interrupt then the same procedure is followed with the other interrupt. I am logging the data read from the FIFO to a tdms file and observed that I am losing some data. I fiddled around with the no of elements to be read from the FIFO on the RT side and got varying degrees of loss. Is this because the RT VI is executing strictly in parallel and hence always services interrupt 1 first, then zero hence leading to data loss?? Also this means that the interrupts from the FPGA aren't really working like interrupts but the situation is sort of similar to polling. You wrote your code to wait for interrupt 0, then for interrupt 1, and then loop and repeat, so it's doing exactly what you would expect. You have the output from Wait on IRQ 0 as an input to Wait on IRQ 1 (with some other functions in the middle), so your code doesn't start waiting for IRQ 1 until it has already acknowledged IRQ 0. What you're getting is sequential, not parallel, execution because you wired it that way, and there's no polling. The Wait on IRQ function allows you to supply an array of values so that it can wait for any of several IRQs, and that's what you want. Wait for either IRQ 0 or 1, do the appropriate processing/logging based on which interrupt was asserted, then loop and go back to waiting again. Quote Link to comment
Roger_1 Posted July 22, 2010 Report Share Posted July 22, 2010 You need to have separate loops for WSS-RPM and ACC in FDAQRT.vi Quote Link to comment
nishad Posted July 23, 2010 Author Report Share Posted July 23, 2010 RTNEW.viFDAQFPGA.viThank you all for the suggestions. I have changed the RT VI so that the WSSRPM and ACC FIFO interrupts are acknowledged in parallel loops. I changed the FPGA VI to interrupt after a set number of acquisitions. This was beneficial in two ways. The interrupt generation frequency has been greatly reduced. When RT gets the interrupt, I know exactly how many values to read, and those number of values are already in the FIFO, meaning RT doesnt have to wait before reading the values. After these changes, the program has been working satisfactorily. But I have run the program only for a few mins each time. I would be grateful if you could just look through the code and verify it. If you could suggest any changes to make the programs better, I would greatly appreciate them. Thanks Nishad Quote Link to comment
ned Posted July 23, 2010 Report Share Posted July 23, 2010 I have changed the RT VI so that the WSSRPM and ACC FIFO interrupts are acknowledged in parallel loops. I don't see any good reason to separate this into two loops. Make it one loop, use an array of IRQ numbers (containing two elements, 0 and 1), and pass the IRQ(s) Asserted output as an input into a case structure (inside a for loop) that determines what logging action to take. It's a bad idea to open multiple reference to the same FPGA VI. If you must use multiple loops, fork the reference wire rather than opening a second reference. The way you're doing it will work but is not recommended; see the LabVIEW help for "Using Multiple FPGA VI References for the same Target." Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.