Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing Frame ONLY on First Read

Solved!
Go to solution

Hey guys!

 

I have an odd problem I'd love some help on.

 

I'm writing from a NI-9862 card that's in a cDAQ 9188 chassis to a CAN device within the network. I'm trying to implement a command/response architecture with the device to verify the command has been successful. Please find the attached block diagram to see the code.

Question:
Everytime I try to write, then read the response from the device, I don't see anything from CAN Read ONLY the very first time it's called. After that it works like a champion. I tried playing with the wait times of the Wait function, the loop wait, the timeout values...pretty much everything I could think of. I opened up the NI-XNET bus monitor and confirmed that I am indeed getting a response back from the device, however, my code doesn't reflect this. Interestingly, when I run the  NI-XNET read VI in a loop of it's own, it reads it just fine.

 

Hopefully one of you guys can give me a pointer or two 🙂

 

Thanks!

Download All
0 Kudos
Message 1 of 4
(5,146 Views)

Have you tried putting the read before the write in the loop? Sometimes I've seen this fix weird issues like this. It looks like in the example 'CAN Frame Input Output Same Port Single Point.vi' this is how they do it. 

Daniel Parrott
Software Product Marketing - Data Management & LabVIEW
National Instruments
Message 2 of 4
(5,126 Views)
Solution
Accepted by topic author Shehzaada

Call start first. XNET impliictly starts on I/O access (write/read). You are calling write first (starting the writer) then calling read (starting the reader). If you want the reader started before the first write, call Start on the read session outside of the loop.

Message 3 of 4
(5,112 Views)

worked like a charm! Thanks so much

0 Kudos
Message 4 of 4
(5,107 Views)