I'm new to CAPL programming and trying to create a node which can send an message with Checksum (CRC 8 SAE-J1850) and message counter to my ECU via CAN bus.
The polynomial used is P = x^8 + x^4 + x^3 + x^2 + 1 -- Init value = 0xFF
Can anyone help me with a CAPL script to encode the 32 bit message to send on CAN bus.
Thanks
I suggest to read and understand first how to calculate crc in http://www.sunshine2k.de/articles/coding/crc/understanding_crc.html
together with AUTOSAR specification you would be able to create script.
there are 2 way to calculate crc:
you should try both to cross check results are identical.
the program flow, you could also follow AUTOSAR Spec.
also cross check when payload change with calculator in http://www.sunshine2k.de/coding/javascript/crc/crc_js.html
here is sample code: