LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN message availability

I am currently writing an application (LV8.2) for battery pack testing. The application checks communication with a BMI, and communication to the battery is over CAN. I use two CAN cards on the test PC and the Channel API subVIs to read and write from and to the CAN-bus. Reading and writing happens at a specific rate and it works just fine.

The problem I have, is that I can’t determine when a message is not present anymore.

For example the BMI sends out a CAN message periodically that I read from the CAN bus. Suddenly the BMI crashes and stops to send out the message, but I wont recognize. Has one of you an idea for a method to determine the presence of a message?

I know that’s a tough one, but thanks for your help…

SDFlow
0 Kudos
Message 1 of 3
(2,727 Views)
My first thought is to use the timestamp on the read.  If your latest timestamp for a message gets too old, then you know it's not being sent anymore.  You'll have to determine what "too old" is, however.

Hope this helps,
Robert Mortensen
CLA, CLED, LabVIEW Champion, Principal Systems Engineer, Testeract
0 Kudos
Message 2 of 3
(2,712 Views)
Hi SDFlow,

Three options come to mind:

  1. When using the Channel API with a sampled (periodic) read, you can use error out terminal to determine whether a new message has been received since the previous call to CAN Read.vi (or CAN Start.vi). If no message has been received, the warning code 3FF62009 hex is returned in error out. If a new message has been received, the success code 0 is returned in error out.
  2. You could use the Channel API with a timestamped read (mode Single-Chan Multi-Samp 1D Time & Dbl or Multi-Chan Multi-Samp 2D Time & Dbl) and have your code inspect the timestamps.
  3. You could use the Frame API and configure a CAN Object for receiving a frame (Communication Type: Receive Unsolicited) and specify the desired timeout as the 'Period' value of the configuration cluster. In the Receive Unsolicited mode, the 'Period' will be treated as a timeout and the ncReadObj.vi will return a timeout error if no frame of that particular ID was received in the given time.
    Note: The CAN Object is 'per-CAN ID'. Thus, if you are interested in monitoring multiple different frames with different IDs, you need to configure a CAN Object for each CAN ID.
-B2k
0 Kudos
Message 3 of 3
(2,685 Views)