1

I am in a project and I have to comply with ISO26262 so I need to verify my CAN frame. I am going to check my frame using the CRC calculation. My question is: Should I do this calculation in my program or does the CAN protocol already do it automatically?

Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
  • Protocols don't do anything automatically. Protocol is a convention. Your underlying hardware/transceiver might do some calculations for you, but we have no idea about it. – Eugene Sh. Mar 09 '22 at 18:11
  • [CAN Bus - wiki](https://en.wikipedia.org/wiki/CAN_bus) does say so. Senders add it, receivers verify it. – जलजनक Mar 09 '22 at 18:27
  • It's scary that you are in a ISO 26262 project without knowing this. Are there truly no semi-experienced engineers in your project team that know the basics of CAN? – Lundin Mar 10 '22 at 08:03
  • 1
    @EugeneSh. CAN _controllers_ do the CRC calculation, the transceiver is just a dumb voltage level converter. The CAN frame on the data link layer might sometimes be referred to as "protocol", nothing strange in that. – Lundin Mar 10 '22 at 08:04

2 Answers2

2

Actually, you might not just rely on the CAN CRC itself in the case of ISO26262.

Because, the E2E protection (as it is called in AUTOSAR) consisting of CRC + SeqCounter, are done between two SWCs, in an ASIL-context.

The BSW is usually not ASIL. So, between the SWC providing the data to the BSW, and the receiving SWC checking the CRC, anything could happen in between. So, your BSW could put some flipped data into the CAN HW mailbox. The CAN HW will then build the wrong CRC when transmitting that data. Or the receiver might have a bug and flip the received data between the CAN mailbox and the actual receiving SWC end.

kesselhaus
  • 1,241
  • 8
  • 9
  • Hi, yes I know that I also need to use a counter but in my case I will buy the embedded hardware from TTControl and my unique task is to program it. So, in this case the counter should be done by the hardware supplier or by me as a software developer? – Yasin Ahsen Mar 13 '22 at 15:24
  • As I've written, the E2E protection is done in the RTE using the E2E profile needed. Because the SWC ports are the "end points" not the CAN HW. And if you are in an AUTOSAR environment (automotive?), you should implement an E2E Profile as defined in the AUTOSAR specs. e.g. E2E Profile1 or Profile2 (see AUTOSAR_PRS_E2EProtocol.pdf and AUTOSAR_SWS_E2ELibrary.pdf). Which profile is used, is stated in the SystemDescription usually. – kesselhaus Mar 13 '22 at 23:25
1

CAN contains a 15 bit CRC on the data-link layer. It is handled by the CAN controller and you don't need to do a thing in software, other than checking for errors reported by the controller.

Application layer CRC could be use in some special cases like when you are transferring large amounts of data such as bootloaders. But it isn't necessary for ordinary communication.

Lundin
  • 195,001
  • 40
  • 254
  • 396