Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

The second frame lost in CAN communication when use NI PCI-CAN/XS2 card

Solved!
Go to solution

I got a trouble on CAN communication recently.

 

 I need to commmunicate a Cluster with CAN BUS,the baud rate is 500kBPS,the CAN card is NI PCI-CAN/XS2. The operating system is Windows XP.

 

normally,the PC send a command to Cluster,then read back a frame of data from the Cluster,but for some commands,the Cluster will return two frames of data,and the programe on PC cannot receive the Seconds frame,it lost.

 

I searched the forum,most of the reslut is the error about CAN BUS overflow,which make the CAN frame lost,but there is not any error report on my programe,and the baud rate is no that fast,I also use another port of NI PCI- CAN/XS2 to monitor the CAN bus,the second data frame never appear,when I replace NI CAN card with Vector CanCaseXL(CAN card) ,and call CanCaseXL's DLL in labVIEW,it can get the second CAN frame,the monitor of Vector CanCaseXL can get the second data frame too.

 

so,is there some software/hardware configuration need to be done to get the second data frame?

 

the attached pictures are NI-CAN/Vector CAN monitor and CAN init/write&read in my programe.

 

Any reply is appreciate!!! thanks

帖子被iwanttofly014在 12-12-2009 07:41 PM
时编辑过了
帖子被iwanttofly014在 12-12-2009 07:43 PM
时编辑过了

Flying...
www.vihome.com.cn 虚拟仪器家园
Download All
0 Kudos
Message 1 of 8
(9,223 Views)

CAN write&read block diagram.

 


Flying...
www.vihome.com.cn 虚拟仪器家园
0 Kudos
Message 2 of 8
(9,220 Views)
Solution
Accepted by topic author iwanttofly014

Hello iwantofly014,

 

I'm sure the frame is not lost.  

 

Could you post your code?  Especially the Get Data VI?  

 

Also, can you make an indicator on the output of the ncReadNetMult? 

 

It seems you are trying to implement the UDS or KWP2000 protocol.  Is that possible?  We have a product that already implements both those protocols and really simplify this kind of application.  Its called the Automotive Diagnostic Command Set.  

 

Have a great day.

O. Proulx
National Instruments
www.ni.com/support
Message 3 of 8
(9,187 Views)

Thanks O_Proulx !

 

I Attached my code use NI CAN frame API.

 

 "make an indicator on the output of the ncReadNetMult",is that mean to check the frame number return from ncReadNetMult? I checked it before,the number is about 26 or less,when I filter the other ID,the number of frame return from ncReadNetMult is 0 or 1.

 

There is nothing about UDS or KWP2000 protocol on Cluster specification,I will contact the manufature of the Cluster to check it out!

 

It seems there is not evaluation version of Automotive Diagnostic Command Set. Or I can try it in my program,but I think the  Automotive Diagnostic Command Set is build on NI CAN frame/channel API,mybe there is some configure I missed,I will keep going!

 

Thank you!

 

 


Flying...
www.vihome.com.cn 虚拟仪器家园
0 Kudos
Message 4 of 8
(9,180 Views)

Hello again,

 

Can you try the modified code I posted?

 

Thanks,

O. Proulx
National Instruments
www.ni.com/support
0 Kudos
Message 5 of 8
(9,155 Views)

Thanks your code.

 

I try the code you posted, It still no work, I found you has improved the "Get data.vi",It works better,but the second frame still no shown.

 

I used the  NI CAN monitor in MAX to monitor the CAN bus,there is no second frame shown in the monitor,See attach pictures.but It shown in the Vector CAN monitor and the code call the Vector DLL.

 

Have a great day.

帖子被iwanttofly014在 12-16-2009 08:02 PM
时编辑过了

Flying...
www.vihome.com.cn 虚拟仪器家园
0 Kudos
Message 6 of 8
(9,147 Views)

I forgot to mention that the Cluster truely uesd the KWP2000 Protocol, So It is sure the Automotive Diagnostic Command Set may useful, I will try this command set.

 

by the way,I am wondering can I implement the KWP2000 Protocol just use the NI CAN API? Is it a hard work for me?

 

or there is something more I need?Such as some NI CAN DLL no open to the user or hard to find.

 

Thanks!


Flying...
www.vihome.com.cn 虚拟仪器家园
0 Kudos
Message 7 of 8
(9,144 Views)

Good news,I have got the second CAN data frame by using  Automotive Diagnostic Command Set.

 

thank your for you help,gook luck!


Flying...
www.vihome.com.cn 虚拟仪器家园
0 Kudos
Message 8 of 8
(9,134 Views)