Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading and parsing of CAN Message Log File

Hi,
 
We have a requirement to read and parse the CAN message log file and details out the message using the CAN DBC file.
 
In detail, we have to develop a tool which will take CAN message log file and DBC file as input. The tool should read each message from the file and check whether the message is present in the DBC file. If so, parse it and output the details of the CAN messages.
 
For e.g. if the message file contains the message "20 40 40 03 04 05 06 07 08 09 0A", then the output of the tool should look like 20 40 40 is the CAN ID for the message name X, 03 is the Byte 0 representing the signal name Y, 04 is the Byte 1 representing the signal name Z etc.
 
The tool application development can be a microsoft application like C# or some scripting languages like XML, Perl etc.
 
Please provide your inputs on the following:
 
1. What software language to use to develop the tool?
2. How to read CAN DBC file from the tool i.e if we use C# then how to read DBC file using C#?
3. Is there any other way to do the above requirement in simple means?
4. Your inputs and suggestions on similar requirements if any?
 
Thanks in advance
Srikumar
 
0 Kudos
Message 1 of 6
(14,023 Views)

Hi Srikumar,

Are you using NI-CAN hardware? If you are, you can use one of the NI-CAN Application Programming Interfaces for developing your tool. The NI-CAN Hardware and Software Manual contains information regarding using the Channel API (chapter 6) or the Frame API (chapter 9) with LabVIEW (chapter 7) and text-based languages (chapter 8).

The following link points to a KnowledgeBase that explains the difference between Channel and Frame API.


NI-CAN Channel and Frame API

You would probably need to use Channel API for your application and the NI Developer Zone tutorial below shows how you can use it in LabVIEW.

NI-CAN Channel API


Thank you,

Simran K
National Instruments
Applications Engineer
0 Kudos
Message 2 of 6
(13,997 Views)
Hi Simran,
 
Thanks a ton for your reply....
 
We are not using NI-CAN Hardware.
 
We are capturing the CAN message from the Infotaintment device i.e Car Radio using SAINT BOX Hardware. We have to process the CAN messages offline.
 
SAINT BOX hardware is a product of Delphi Company. This hardware is used for CAN communication between PC and Car Radio vice-versa.
 
Our goal is to develop a cost effective tool to do the work. Our customer is not intereseted to invest in procurring CANoe or Lab View licenses.
 
Awaiting for more replies !!!
 
Thanks and regards,
Srikumar
0 Kudos
Message 3 of 6
(13,990 Views)
Hi Srikumar,

Since you are not using NI-CAN hardware, it will be hard for us to support you with this issue. Mostly everything on a NI Discussion Forum will be related to NI products. You may try contacting Delphi regarding this issue and they can provide you with more information.

Regards,
Simran K
National Instruments
Applications Engineer
0 Kudos
Message 4 of 6
(13,981 Views)

 

You can probably use perl, C#, biterScripting. I wrote a quick script in biterscripting. Let me know if this works for you.

 

# Open the log file, assuming as C:/logs/xxx.log

var str content

repro "C:/logs/xxx.log" > $content

 

# Get each line one by one

while ($content <> "")

do

  # Get the next line

  var str line

  lex -e "1" $content > $line

 

  # The CAN ID is the first three words (bytes). Since bytes are separated by spaces, we will use the word extractor - wex

  var str CAN_ID

  wex "3]" $line > $CAN_ID

 

  # The Byte 0 is the next byte (or word).

  var str Byte_0

  wex "1]" $line > $Byte_0

 

  # Print the output message.

  echo $CAN_ID " is the CAN ID, " $Byte_0 " is the Byte 0"

done

 

Is good for parsing logs and stuff. I believe you can do a free biterscripting download at their website.

 

0 Kudos
Message 5 of 6
(13,490 Views)

Hello Simran

 

                   I have a same type of requirement Iam Using USB-8473 for my application. I want to parse the captured log file. (.ncl format) i.e splitting the frames in to independent channels. Can you help me out with any code .. Iam really in very urgent need of it.

 

 

Thank you.

Shanth.

0 Kudos
Message 6 of 6
(12,955 Views)