ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CRC15 with LabVIEW

Solved!
Go to solution

Hi LabVIEW Community,

Just to check if anyone did do a CRC15 VI calculation before using LabVIEW? Have been searching through the forums but didn't find any. I am currently tasked to develop a VI to calculate the Packet Error Code for the LTC6811 Chipset developed by Linear Technologies but I realize the Packet Error Code (PEC) is the same as the CAN bus for the first 15 bits, the only difference is the last bit which there is a 0 attached for the Final PEC. I have attached screenshots obtained from the datasheet below


Can any experts advise me on this situation, please?

 

Thanks!

Screenshot 2023-05-16 165515.pngScreenshot 2023-05-16 165528.png

0 Kudos
Message 1 of 6
(3,814 Views)

Hi cyongjed,

 


@cyongjed wrote:

Can any experts advise me on this situation, please?

What have you tried and where are you stuck?

Why don't you attach your VI?

 

The manual is rather clear: you can handle boolean values in LabVIEW and there is a XOR function available…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,803 Views)

Hi Gerd,

Thank you for the response.

I have tried it out with a design of my own version of the VI, and have attached it in the reply. I am currently having issues getting the correct output for the PEC. For example, the PEC of 0x0001 (input DIN) will be computed as 0x3D6E as the final result, but I am getting otherwise. 

 

Attached the bitwise operation for this in the post:

Screenshot 2023-05-16 225154.png

 

Regards,

cyongjed

0 Kudos
Message 3 of 6
(3,756 Views)
Solution
Accepted by cyongjed

Here's what I came up with.  Hopefully, you have more test vectors to try this on to make sure it works.

NOTE: The extra Rotate Left With Carry is to get bit 14 from the PEC (a 15-bit CRC is kind of weird).



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 4 of 6
(3,726 Views)

Hi Cross,

Thank you for the assistance given.

I have a doubt here, why did you use 0x4599 instead of 0xC599? I don't really get this.

Hope to hear from you soon!

 

Regards,

cyongjed

0 Kudos
Message 5 of 6
(3,697 Views)

You always ignore the top item in the polynomial, in this case the x^15.  In this case, it does not really matter since bit 15 is not used in the CRC.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 6
(3,656 Views)