[CanTp] Vehicle Diagnostic Communication Part 21 [Simulation 9]

[CanTp] Vehicle Diagnostic Communication Part 21 [Simulation 9] 車両診断通信
[CanTp] Vehicle Diagnostic Communication Part 21 [Simulation 9]

Click here for back issues.
https://www.simulationroom999.com/blog/diagnostic-communication-en-back-issue/

Introduction.

Let’s simulate ISO-TP. series.
In this article, we will make the FC’s add up to check the multi-frame request of the Python package can-isotp.

How to make a multi-frame request in can-isotp succeed?

The last time we tried to make a multi-frame request with can-isotp, it failed.
The reason was that there was no FC (FlowControl) response from the destination.

As a simple solution, it should be OK if the receiver can respond with a frame equivalent to FC for now after receiving FF.

Respond FC for the time being after receiving FF

The process of responding FC after receiving FF is actually a close approximation to what we experimented with before in python-can.
At that time, we were not particularly conscious of FF and FC, and the process was to send back another CAN frame after receiving a CAN frame.
It should be OK if we clearly recognize FF and FC and process them.

Script for FC response with python-can

Let’s write a script for FC response.
I think we can modify the experimental script of python-can a little, so it should be like below.

import can

# Bus connection
bus = can.interface.Bus(bustype='vector', channel='0', bitrate=500000)

# reception
while True:
	recv_msg = bus.recv(timeout=1)
	if recv_msg != None:
		print('Recv msg : %s' % recv_msg)
		break


send_msg = can.Message(arbitration_id=0x18daF110, extended_id=1, data=[0x30, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC])
print('Send msg : %s' % send_msg)

# transmission
bus.send( send_msg )

It doesn’t determine if the reception is FF or not, but it returns FC triggered by the reception, which should be enough for experimentation.

can-isotp multi-frame request

Let’s try an experiment.

First, start can.logger
After that, we launch the previous script first.
Finally, run the previous isotpsndtest.py.

This time, the process went through without error.

The resulting CAN line log shows the following.

Begin Triggerblock 
 0.000000 Start of measurement
 0.000000 1  18DA10F1x       Rx   d 8 10 1E 01 02 03 04 05 06
 0.001598 1  18DAF110x       Rx   d 8 30 00 00 CC CC CC CC CC
 0.003047 1  18DA10F1x       Rx   d 8 21 07 08 09 10 01 02 03
 0.003170 1  18DA10F1x       Rx   d 8 22 04 05 06 07 08 09 10
 0.003285 1  18DA10F1x       Rx   d 8 23 01 02 03 04 05 06 07
 0.003334 1  18DA10F1x       Rx   d 4 24 08 09 10
End TriggerBlock

In this way, the multi-frame request went through successfully.

Actually, the behavior is a bit unexpected, but this will be explained in the next issue.

Conclusion

  • The FC’s add up in python-can.
  • Supported by inserting CAN frames with a bit of timing in python-can.
  • This allowed the multi-frame request to go through for now.

Click here for back issues.

コメント

タイトルとURLをコピーしました