I'm currently working on some tests for a CAN node, where I'm using python-can and Linux SocketCAN to send and receive CAN frames from the node.
Regular sending and receiving is working fine, but now I want to inject faults and see how the CAN node behaves.
Does anybody know if it's possible to do this, for example by changing the CRC of the frame. I already have one test where I take down the CAN interface, so the node goes bus-off, but there are so much more CAN errors to test.
Edit: To make thinks clear: I'm working on a test framework, using pytest and python-can, and for regular sending of CAN-frames I have the following code:
import can
bus = can.interface.Bus(bustype='socketcan', channel='can0', bitrate=250000)
msg = can.Message(arbitration_id=can_id,
data=data,
is_extended_id=False)
bus.send(msg)
And here it stops for me, What I can read for the API, there is no option for fault injections here ( Pyhon-can API ).
A another example of what I have today:
import can
bus = can.interface.Bus(bustype='socketcan', channel='can0', bitrate=250000)
msg = can.Message(arbitration_id=can_id,
data=data,
is_error_frame=True)
bus.send(msg)
Above codes generates error frames on the bus, that is part of the fault-handling tests I'm designing.