[CanTp] Vehicle Diagnostic Communication Part 22 [Simulation 10]

[CanTp] Vehicle Diagnostic Communication Part 22 [Simulation 10] 車両診断通信
[CanTp] Vehicle Diagnostic Communication Part 22 [Simulation 10]

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, I will explain the parameters of the multi-frame request of the Python package can-isotp.

Discomfort in seeing a multi-frame request for can-isotp.

Last time, a multi-frame request for can-isotp was performed, and the log at that time is shown below.

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 a manner of speaking, this is a successful multi-frame risk est.
However, careful inspection shows that there is no padding on the last CF.

This is not wrong.
It seems that in the default state of can-isotp, the “DLC optimal specification” is adopted.

There is no problem for communication.
However, some manufacturers do not want to adopt the “DLC-optimal specification” if possible, if not to the point of not allowing it.

The purpose of this article is to switch this behavior.

Switching the DLC optimization specification for can-isotp

Let’s write a quick script to see if it is possible to switch.
The following is a script to check.

import isotp 
import time 
from can.interfaces.vector import VectorBus 

isotp_params = { 
    'tx_padding’ : 0xCC,
    'tx_data_min_length' : 8 
} 

bus = VectorBus(channel=0, bitrate=500000) 
addr = isotp.Address(isotp.AddressingMode.NormalFixed_29bits, source_address=0xF1, target_address=0x10) 
stack = isotp.CanStack(bus, address=addr, params=isotp_params) 

#stack.send(b'\x01\x02\x03\x04\x05\x06\x07’) 
stack.send(b'\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\
                     \x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\
                     \x01\x02\x03\x04\x05\x06\x07\x08\x09\x10’)
 
while stack.transmitting(): 
    stack.process() 
    time.sleep(0.0001) 

bus.shutdown()

As you may have noticed right away, the number of parameters passed to CanStak has increased.
CanStack has an argument called “params” which is used to set communication parameters, and it seems to be able to switch the behavior.

Let’s actually run the program and take a log.
The result is as follows.

Begin Triggerblock
 0.000000 Start of measurement
 0.000000 1  18DA10F1x       Rx   d 8 10 1E 01 02 03 04 05 06
 0.001294 1  18DAF110x       Rx   d 8 30 00 00 CC CC CC CC CC
 0.003219 1  18DA10F1x       Rx   d 8 21 07 08 09 10 01 02 03
 0.003309 1  18DA10F1x       Rx   d 8 22 04 05 06 07 08 09 10
 0.003359 1  18DA10F1x       Rx   d 8 23 01 02 03 04 05 06 07
 0.003408 1  18DA10F1x       Rx   d 8 24 08 09 10 CC CC CC CC
End TriggerBlock

The padding is in, with no problem.

And I was told that it is possible to change the can-isotp behavior.

Conclusion

  • In the default state of can-isotp, the DLC optimization specification is adopted.
  • If you set padding and MIN_DLC in the parameters passed to CanStack, it switches to the padding specification.

Click here for back issues.

コメント

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