Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Checksum calculation for a CAN Message

Hi all,

I have created CAN interfaces using vector dbc file in MAX explorer and they are working fine. I have transfered these interfaces on to RT Target (a desktop PC using as RT) successfully. When I give raw data to  these created CAN interface(s), they r forming a readymade CAN message and sending on to  physical CAN port.  But before sending this readymade CAN message over physical channel, I shall calculate checksum of this CAN message. We have a custom checksum code which needs exact CAN message (7 bytes). After calculation of checksum I'll join checksum with readymade message and will send over physical CAN port. I need help to access readymade CAN message sothat I can pass this message to checksum code to create checksum byte. Hope I have explained my problem.......I use NI PCI-CAN/2 Series 2, with RT.

Thank you,

Ravinder
0 Kudos
Message 1 of 4
(11,405 Views)
Dear Ravinder,

I'm not sure what do you mean with "... join checksum with readymade message and will send over physical CAN port ...".

If you want to write to the CRC-field of the CAN frames you're out of luck, the SJA1000 controller handles that by itself.

But if you only wish to write your own checksum to the data field of each frame, you can build up new messages containing your checksum using the CAN Create Message.vi.

Hope this helps!

Philipp R.
0 Kudos
Message 2 of 4
(11,374 Views)
Hi Philipp,
I have provided code what I'm using. It's not included loops. I'm providing to explain my problem. Once "task write.vi" genrates CAN message, it's directly sending to physical CAN port. But, I want to use that generated CAN message to calculate the checksum of the message. Is there any way (or other vi) to use the CAN message without sending it to physical port, sothat I can calculate checksum. Latter I will to send CAN message with checksum it to physcial CAN port. Now, I'm using virtual CAN interfaces to generate and read CAN message sothat I can calculate checksum and then sending message with checksum over physical port. At this time it works, bcoz I'm sending only one CAN message.but in latter stage I'll send 5 to 8 CAN messages at a time to external hardware (ECU).

Thank you,

Ravinder


Message Edited by Ravi0709 on 05-21-2008 08:52 AM
0 Kudos
Message 3 of 4
(11,370 Views)

Dear Ravinder,

to get the raw (frame) data of CAN channels you can use the CAN Frame Channel Conversion Library.

Best regards

Philipp R.

0 Kudos
Message 4 of 4
(11,344 Views)