I want write multiframe data to the sensor and then read the sensor response. I am able to do the coding and the problem is code works sometimes and gives timeout error suddenly. I am not able troubleshoot this behavior of my code. The same code works fine sometimes and next time it gives timeout error in ncWaitForState.vi after the ncwriteobj.vi.
please see the attached snapshot of my code (it's not possible for me to attach the vi)
Any help would be appreciated.
what kind of VI´s are these blue VI´s?
I found a Knowledge Base regarding this issue. Maybe it helps.
If your hardware was made in the last 5 year I highly recommend using the XNet drivers over the series 2 CAN drivers known as NI-CAN. There is tons more flexibility in controlling the ways data is read and wrote. Also posting a VI or snippet is better than a picture. I can't open a picture in LabVIEW.
The card is very old. Its PCI CAN series 2 card. I can't use XNET drivers with this card.
Not possible to upload vi because its part of a very big software and I am not allowed to that. 😞
if your error appears at ncWaitForState.vi / Write Success after the ncwriteobj.vi there could be the only possibility that your timeout of 50ms is not sufficient. On a high busloaded network (which baudrate do you use?) you may not be able to get the frame onto the network in time. Have you tried out to increase the timeout value? (what average busload do you see on the network? run the BusMonitor from MAX; which shows the detected busload in %)
from your first subvi I see that you may do kind of diagnostic protocol like UDS? If so, you may consider to use the Automotive Diagnostic Command Set
which implents UDS and KWP2000 for NI-CAN and NI-XNET. NI-CAN should be ok to run any protocol like UDS/ISO TP.
I tried with higher Timeout values but I have the same problem. I am using 250 Kbaud. The average bus load is around 22%.
Yes, I am using UDS over CAN for the diagnostics purposes. I have the Automotive Diagnostics Command Set but the problem is it supports
only LV version 10 and above. And the LV software is developed in LV 7.1, so I can't use it.
so you increased the write timeout to something = 1000ms? and the frame would never be transmitted?
how big is your transmit queue of the transmit object? is the queue empty before you call the write frame?
The state "Write Success" is set when the last frame in the write queue is transmitted successfully,