LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

900x Interrupt Read example error

   I've got a program that does serial communication on FPGA targets using a 9871 module.  The code was originally developed by copying the NI example called "NI-987x Serial Loopback", using the RT program called "900x 9870 Interrupt Read" for the reading routine.  After puzzling for a long time about why our serial reads took so long, I finally discovered a bug in the example.  The way the interrupts are structured and the way the FPGA code is written, when the RT serial read VI finally gets all the bytes it expects, it sends an Acknowledge IRQ to the FPGA inside the read loop, and then a Wait on IRQ outside the read loop, to ensure that the FPGA finished and is ready for the next request.  However, the FPGA code is structured such that when it gets the Acknowledge IRQ, it loops through its Read case again.  But since there is no more data coming in, it waits for a Byte Timeout.  Which is where the unnecessary extra delay was coming from.

   My fix is to put a case structure inside the Read loop (in two places, actually, due to a case structure already inside the Read loop), between the Byte Read and the Acknowledge IRQ.  The case fires True only if the Read loop is done.  (I had to move the condition logic inside the existing case structure as well.)  Inside the new True case, I set the Op Control on the FPGA program to Do Nothing.  Then when the FPGA gets the final Acknowlege, it knows it doesn't need to Read, but instead goes through the Do Nothing case and responds very quickly with the next IRQ that the RT is waiting for.

   I don't have my VI with me to attach at the moment, so I hope the above explanation is adequate.  Since it's only a few hundred words, it's probably only about 1/4 as valuable as a picture would have been...


DaveT

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 1 of 2
(2,138 Views)

Dave,

 

Thanks for passing that along!  If you get a chance at some point, being able to attach the VI would be nice, but that's a pretty good description of what's happening.  I'll look into that a little more on our end and pass that information along here to make sure that this is corrected if it's not working like it should be.  Thanks again for the feedback!

Regards,
Austin S.

National Instruments
Academic Field Engineer
0 Kudos
Message 2 of 2
(2,118 Views)