07-15-2016 09:28 AM
I have more general question. I am new to CAN interface and I just trying to understend better functioanlity of NI-XNET input vi.
MY main issue was that when I ran vi by itself, It was working just fine. Read every frame my MCU was sending.
When I put the same vi as part of main program, I start missing frames if I write to MCU first. I have to run input vi few times until evensually I get a frame.
If I strat the program and only do inputs then vi was getting every frame.
I was using PCAN scan program to read the same MCU, and it was getting 4 frames every 100ms everytime.
I am only trying to read one ID frame.
When I increased timeout time to 100ms it seems made program more stable.
I was not sure why it helps. I am using frame in queued. Does it mean that the buffer will hold the data until vi gets there?
THis is Frame IN VI
The same Vi as part of Main vi
Fram out Vi that use in Main VI.
Solved! Go to Solution.
07-18-2016 05:47 PM
The Frame In Queued VI, as explained in the XNET Hardware and Software Manual (pg 4-15), allows you to read data a sequence of data specific to a frame. Therefore, the read will only return values of that frame only. If you are only trying to read in one ID frame this should work well for you. Expanding the timeout might be correcting the behavior because the specific type of frame you have specified is not coming within the shorter timeout.
But I am curious why it is behaving differently when you write first vs when you don't write. I would like to see what is going on. You can use the NI-XNET Bus Monitor to Monitor the bus when you don't write and when you do write before reading the frames. This will help me see if what you are seeing is expected or if something needs to be configured differently.
07-18-2016 06:17 PM - edited 07-18-2016 06:18 PM
HI,
I think the increasing timout time resolve the issue, Wehn I ran manualy th elop was slow enough that data alredy was in the queue.
When I ran vi as part of the main loop, I think vi was expecting data before data got there.
07-19-2016 06:58 AM
I would not keep opening and closing your sessions. Open at the beginning, close at the end and just do the reads in the middle. If a frame is received by the hardware without an active session, it will be discarded.