Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN request and response

Solved!
Go to solution

I am currently working on a project involving a motorcycle in which I need to obtain the DTC codes after applying various external conditions. I have not used CAN before and am running into some issues on basic communication using NI's provided examples.

 

I am using a NI PXI-8513 (2 port) along with the NI-XNET drivers and the NI-XNET Database Editor. 

In order to obtain 'permission' to the device, I need to first do the following:

Client requests seed > Server sends seed > Client sends key based on seed > Server responds with unlock succeess and unlocks services

 

According to my documentation, I knowrequestseed.JPG

SendKey.JPG

 

 

Based on this information, I have created a CAN Cluster with two frames and 2 signals on each as shown. The Seed_Request signal is made up of 2 bytes, the Seed_Response is 3 bytes & vice-versa on the key commands. 

databaseEditor.JPG

 

However, I do not get a response and I'm not even sure if I have it set up to properly get any kind of response. I believe my arbitration ID is set based on the $27 but I do not know for sure. I have also attempted to use the NI-XNET Bus Monitor to 'Transmit Single Frame', but I do not receive anything in the Bus monitor/ID Logger/Statistics (i'm not sure if it would go here even). For better troubleshooting, I have both ports hooked up in parallel and can see the signal i send using both the receive single frame and send single frame vi's, but never see a response from my device. I know that i have proper settings for baud rate (500K), termination on (no physical 120 ohm resistors on cable), high speed, and standard id length (not extended)

 

I appreciate any help from someone a little more experienced in this type of communication and possibly some direction on what else I should be trying. Thank you for your time and assistance!

 

-Rick

 

databaseEditor.JPG

0 Kudos
Message 1 of 4
(7,278 Views)

First off, what do you mean by no physical termination? Are you using an NI CAN cable, or a cable with termination built in? You must terminate the bus in order for it to behave correctly.

 

Second. Try a loop back test. In the LabVIEW example finder under Hardware Input and Output >> CAN >> NI-XNET >> Advanced >> Loopback Test.vi. Connect the two ports to each other in a loopback fashion and run this test. This will show us if the CAN ports are properly communicating. If they are, then we know the problem is on the device side.

National Instruments
0 Kudos
Message 2 of 4
(7,252 Views)
Solution
Accepted by topic author fredboy

Thank you for your response. I am not using an NI CAN cable, but have the twisted pairs going to both appropriate ports. Doing a loopback on this shows a success, with no termination resistors and enabling the PXI internal termination.

 

I was able to establish communication this morning after reading back with the CAN Frame Input Stream vi instead of the single point. I was able to see that the $67 address wasn't reporting anything, but the $5C0 and $5C1's were. I assume that is because I did not have this databases set up and therefore was not looking to any address that was actually talking. 

 

Thank you for your advice!

0 Kudos
Message 3 of 4
(7,250 Views)

Maybe you have this figured out already, but it looks like you're working with the UDS protocol on CAN.  $27 is not the arbitration id, it's the "service request" id, the first data byte of the frame you transmit; the arbitration id you should use is the "segmented request" id specified by the manufacturer of the motorcycle.  The response will be on the "segmented response" id specified by the manufacturer, and the first data byte of the response frame will be $67.  These numbers are hex, by the way.

0 Kudos
Message 4 of 4
(7,164 Views)