Jump to content

RT Acknowledge Interrupts


nishad

Recommended Posts

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.

Link to comment

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.

Link to comment

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

Link to comment

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."

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.