Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

XNET Memory Design and Management

Solved!
Go to solution

Hi All,

 

I'm brand new to NI-XNET, using LabVIEW 2018 and an NI CAN peripheral.  I think my application requires the Frame Input Stream Mode because I need to analyze all frame traffic on the network, which does not conform to standard frame/signal definitions.  The XNET Read (Raw Frame) VI returns all frames in the Raw Frame format.  I think the application must poll XNET Read (Raw Frame).

 

How are frames buffered, and what properties can I use to monitor or configure the buffer?  For example, are frames buffered in HW, in the driver's space, in application space, in all?  Can I see or configure the size of these buffers?  What will happen if the buffer overflows?  I'm trying to design the polling period, which I think is a function of the frame rate and the buffer size.

 

I appreciate any feedback or help,

 

Steve K

0 Kudos
Message 1 of 4
(3,335 Views)
Solution
Accepted by topic author Pie566942.0

Frame Input Stream is really the easiest to understand.  You perform a read, and get all the frames that have arrived since the last read.  I'd never used the Raw Frame read for any project and don't see the usefulness of it.  I'd avoid it if I were you as I suspect it isn't what you want and you actually want to read the frames, or signals if you have a DBC.

 

Frames are buffered by the hardware.  There is a hardware buffer that can be polled, and the buffer size can be changed with the property Queue Size on the session.  I think Number Of Values Pending can tell you how many frames there are to be read.  Still the read function has a Number to Read, and a timeout.  So you can put in a 100ms timeout to read a single frame and then you don't need to constantly be polling.  I mean you will be polling but the rate of the polling will be determined by how many frames there are to read.  I sometimes do a read with a 100ms read for 1 frame, and then if it doesn't timeout I'll perform a second read to get all the remaining frames with no timeout.

 

If you go to Help >> Find Examples there are several shown for XNet, and one for the Frame Input Stream which shows the basics.  And if you haven't seen it I have a CAN Blog that covers a range of topics, some of which touch on XNet and different session types.

Message 2 of 4
(3,324 Views)

Thanks Hooovahh, that was very helpful.  I'll consider reading the frames instead of raw, I'll use the timeout/# to read terminals as you suggested, I'll take a look at those buffer properties and your blog.  Thanks for your reply! -Steve K

0 Kudos
Message 3 of 4
(3,314 Views)

FWIW, I used the error ring to browse NI-XNET errors and found the one I think indicates a buffer overflow:

Untitled.png

-Steve K

 

 

 

0 Kudos
Message 4 of 4
(3,302 Views)