From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

[XNET][CVI2013] Check for CAN periodic signal

Solved!
Go to solution

Hello,

 

I'm using CVI 2013 and the NI Automotive Diagnostic Command Set 1.1 toolkit. 

Board NI PXI 8513 (2 CAN bus)

 

I want to know how can I check if a periodic signal is currently about to be sent on CAN ?

 

Best regards,

blue

0 Kudos
Message 1 of 14
(5,843 Views)

Hello Houssam,

Can you clarify your problem statement and provide us with additional details?

 

Are you wanting to know what position a frame is at in a buffer? How to read the cycle time of a frame? Is your applicaiton sending or receiving this signal? Are you talking about using the XNET or ADCS API to perform this task?

Jeff L
National Instruments
0 Kudos
Message 2 of 14
(5,821 Views)

Hello JefeL, 

 

My application is installed on my TestBench that has a CAN board (NI PXI 8513). I need to develop a function.

When I connect a CAN equipment to this board and I start reading CAN frames coming from this equipement (so my application is receiving the signals), I want to be able to say if, in reading mode, there is a periodic signal coming from my equipement or not.

I'm not looking for details like cycle time etc.. I just want to check if Yes or No periodic signal presence is detected. 

 

To perform that, I can use the XNET or ADCS API. I have both of it and I'm free to use it. 

 

Regards, 

Blue

 

0 Kudos
Message 3 of 14
(5,806 Views)

Since you are receiving a CAN frame from an external device, we are limited by the information contained in that frame. Unfortunately, the frame does not contain any informaiton about whether it is cyclic or not. 

 

The same can be said for the transport protocols in ADCS. Your device may send a packet of frames as part of a larger message, but we won't be able to tell if the larger message is cyclic or not based on the information contained in the frame.

 

The exception to the above rules would be if a part of the payload contained information about the cycle time or next transmission of the signal. An application specific example would be for a device to dedicate a portion of the payload to indicate the signal is cyclic and at what rate. Not being part of the protocols themselves, detecting this information and interpreting it would also need to be implemented application specific.

Jeff L
National Instruments
0 Kudos
Message 4 of 14
(5,796 Views)

If you have a database for the system, then we do have properties you can read to determine if a frame is expected to be cyclic or not. This won't depend on the actual receipt of a frame and does not guarantee that a recieved frame will be sent in a cyclic manner.

 

Look at the CAN:Timing Type property of a frame and that will tell you if a frame is expected to be cyclic or event based (page 4-359). 

http://www.ni.com/pdf/manuals/372840l.pdf

Jeff L
National Instruments
0 Kudos
Message 5 of 14
(5,793 Views)

Thak you JefeL,

Do you have an example with the CAN:Timing Type property please ? 

 

Regards,

Blue

0 Kudos
Message 6 of 14
(5,790 Views)

There is a shipping example called CAN Dynamic Database Creation that demonstrates how to manipulate database objects.

 

Within that example, there is a sub VI called NI-XNET Example SubVI - Create CAN Frame.vi. This sub VI shows how to use the property to set the CAN.Timing Type attribute and reading it should be a straightforward reversal of the process.

 

Edit: Sorry I didn't notice that you were using CVI. I will have to take a look at the CVI examples and see what I can find. 

Jeff L
National Instruments
0 Kudos
Message 7 of 14
(5,788 Views)
Solution
Accepted by topic author BlueAnaconda

I couldn't find a CVI example that demonstrates using the nxGetProperty function to obtain the timing type and transmit time of a frame. If I have time on Monday I will try to set one up.

 

In the mean time, I can provide a quick LabVIEW snippet to demonstrate the general idea of how to get these properties from a session reference:

CheckTimingType.png

Jeff L
National Instruments
0 Kudos
Message 8 of 14
(5,759 Views)
Solution
Accepted by topic author BlueAnaconda

We performed a quick modification to an existing CVI example called CAN Frame Single Point Input. In this example code, we first get a list of frames handled by the session. We then read the timing type and transmit time of the first frame returned. The end result is almost identical to the LabVIEW code posted earlier. To see all of the modifications, compare the attached files with the original shipping example.

Jeff L
National Instruments
Message 9 of 14
(5,737 Views)

Thank you JefeL, I will try to do the same in my code and I will keep you posted ! 

 

Regards, 

Blue

0 Kudos
Message 10 of 14
(5,690 Views)