Discussion:
Checksum calculation for a CAN Message
(too old to reply)
Ravi0709
2008-05-19 13:10:08 UTC
Permalink
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
Philipp R.
2008-05-21 13:40:09 UTC
Permalink
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.
Ravi0709
2008-05-21 14:10:09 UTC
Permalink
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,RavinderMessage Edited by Ravi0709 on 05-21-2008 08:52 AM


rough diagram.PNG:
http://forums.ni.com/attachments/ni/30/3484/1/rough diagram.PNG
Philipp R.
2008-05-23 13:10:08 UTC
Permalink
Dear Ravinder, to get the raw (frame) data of CAN channels you can use the <a href="http://joule.ni.com/nidu/cds/view/p/id/884/lang/en" target="_blank">CAN Frame Channel Conversion Library</a>. Best regardsPhilipp R.
Continue reading on narkive:
Loading...