Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Blocking read using NiFpga_ReadFifoU32 and a timeout

Greetings,

I'm accessing a FlexRIO 7954R card using the Linux C API generated from an FPGA bitfile that supports several 422 channels.  Data from each serial port is queued in a FIFO and retrieved with calls to NiFpga_ReadFifoU32().  When I call the ReadFifoU32 function with a non zero timeout I see my thread wait the appropriate amount of time before returning when no data was in the FIFO but the CPU utilization goes to 100%.  Is ReadFifoU32 simply busy waiting during the specified timeout period?  If so, is there a method in the C API that will actually block the calling thread?

 

Thanks,

Dave

0 Kudos
Message 1 of 2
(3,315 Views)

Hi daowens.

 

Long story short, this is expected behavior to a certain degree.  Typically speaking, the host will poll the FIFO as fast as possible.  There is a KnowledgeBase article that speaks to a similar situation with the interaction between an FPGA target and an RT target that may provide you with further information.

 

AE KB 4X1GBJDK: Why is My Real-Time CPU at 100% When Reading from a DMA FIFO (FPGA)?

 

I hope this information helps.

 

Regards,

 

Michael G.

Michael G.
Applications Engineer
National Instruments
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Self-realization: I was thinking of the immortal words of Socrates, who said, "... I drank what?"
0 Kudos
Message 2 of 2
(3,294 Views)