07-19-2016 06:37 AM
@jay0909 wrote:
[...] The calculated CRC on labview part is wrong.
[...]
Please do attach the VI(s). Without seeing the code, there is not much to help you with.
My assumption is: The CRC32 you read from the controller is correct (226F9471 in your original example).
However, you do compute a CRC32 in LV from the frame (1C000000B0B80700040400000000000000) and end up with a different CRC32 (9D0351B5).
So it seems that there is something wrong in your LV implemented CRC32 calculation. Did you implement it yourself or downloaded it from somewhere?
Norbert
07-19-2016 07:44 AM
Hi,
I did not implement i used the IEEE 802.3 CRC 32 vi for calculation. The attached vi contains crc without validation and ieee 820.3 crc 32
07-19-2016 08:00 AM
There are multiple errors in the CRC vi. It starts that the typecast of the string is invalid: Two characters represent one byte. Your typecast simply transfers each character to a byte (using ASCII table)
Here is what you can do (caution: not very well in regard to performance):
Then there is obviously a big mistake in the CRC implementation itself because when correcting the cast, it still results in an incorrect CRC. Where did you get that VI from?
Norbert
07-19-2016 08:06 AM
07-19-2016 08:29 AM
@PalanivelThiruvenkadam wrote:
If it's works fine in python it should also work in LabVIEW.
Check with the way it's implemented in python and in LabVIEW and find the difference
Basic CRC is add all the data other than header .
I have seen some protocols that include the header when calculating the CRC. Have you tried to include header + data in your CRC calcs?
07-19-2016 08:37 AM
Yes, I caclculate CRC with header + data
07-19-2016 09:31 AM
Try this implementation.
While it also casts the string imho incorrectly, it does indeed reveal the same CRC32 as you obviously expect.
Norbert
07-19-2016 09:56 AM
Hi,
For this frame i get a different crc
whole frame : 1C0000009DE50200040400000000000000B6CE2D67
CRC : B6CE2D67
Calculated CRC : EB48D85C from LV.
If any ideas please let me know
07-19-2016 10:15 AM
Using that stated frame (excluded CRC) on this CRC calculator results in the same CRC as LV.
It seems that your controller messed that one up.
Norbert
07-20-2016 02:30 AM
I have attached a c code for calculating the crc. This is the code the uart uses to calculate. HOw is it different from labview implementation?