Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

ncWaitForState.vi error behavior unpredictable

Hello,

 

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.

 

 

regards,

swap

0 Kudos
Message 1 of 18
(5,128 Views)

Hi Swap,

 

what kind of VI´s are these blue VI´s?

 

I found a Knowledge Base regarding this issue. Maybe it helps.

 

ncWaitForState Timeout Waiting for Write Success During Periodic Transfer

http://digital.ni.com/public.nsf/allkb/3C89E2ED19D3C8368625714E0059258A

 

Regards,

Nina

0 Kudos
Message 2 of 18
(5,094 Views)

Hi Nina,

 

The blue VI's are NI-CAN VI's used to communicate with PCI CAN/2 Card.

 

 

 

regards,

swap

0 Kudos
Message 3 of 18
(5,085 Views)

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.

0 Kudos
Message 4 of 18
(5,044 Views)

Hi,

 

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. 😞

 

regards

Swap

0 Kudos
Message 5 of 18
(5,028 Views)

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

 

http://sine.ni.com/nips/cds/view/p/lang/en/nid/203554

 

which implents UDS and KWP2000 for NI-CAN and NI-XNET. NI-CAN should be ok to run any protocol like UDS/ISO TP.

0 Kudos
Message 6 of 18
(5,020 Views)

Hi,

 

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.

0 Kudos
Message 7 of 18
(5,014 Views)

CAN cable is terminated sufficiently?


0 Kudos
Message 8 of 18
(5,012 Views)

 

 

Yes, it is terminated properly. 😞

0 Kudos
Message 9 of 18
(5,010 Views)

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,

0 Kudos
Message 10 of 18
(5,004 Views)