ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 진단 요청과 응답 m_id 짝 찾기
    application 2025. 1. 26. 16:02

    venue_uds_match_diag_req_resp_m_id_blf

    • 차(베뉴)에서 측정한 CAN 트레이스 (blf 파일)을 분석한다.

    진단 요청과 응답 메시지 아이디들의 짝을 찾는다.

    • 표준에 따르면 진단 메시지의 아이디(m_id)는 0x700에서 0x7FF로 정해져있다.
    • 표준에 Read ECU ID, Read DTC 등 몇몇 서비스는 대부분의 제어기들이 응답한다.
    • 위 두 가지 사실에서 착안하여 m_id를 0x700에서 0x7FF까지 순차적으로 증가시키면서 (스캐닝) Read ECU ID, Read DTC 등의 서비스를 요청한 후, 0x700번대 응답 메시지를 500msec(응답 대기 시간) 동안 기다린다.
    • 응답 메시지가 있다면, 그 메시지의 m_id를 요청 메시지 m_id의 짝으로 판정한다.
    import os
    from pathlib import Path
    import can  # blf 파일 처리를 위해 python-can 모듈을 사용한다.
    import pandas as pd
    ldf is not supported
    xls is not supported
    xlsx is not supported
    # 측정한 blf 파일들
    k_dir_data = Path().absolute()/'data/venue'
    blfs = list(k_dir_data.glob('*.blf'))
    for i, blf in enumerate(blfs):
        print(f'{i:2}: {blf.name:60} {blf.stat().st_size:12,} bytes')
     0: uds_vehicle_config_2025_01_20_16_52_17.blf                      2,607,508 bytes
     1: uds_vehicle_config_2025_01_20_16_54_53.blf                        370,192 bytes
     2: uds_vehicle_config_2025_01_20_16_55_16.blf                      1,311,074 bytes
     3: uds_vehicle_config_2025_01_20_16_56_21.blf                      1,215,600 bytes
     4: uds_vehicle_config_2025_01_22_16_40_23_ecu_id.blf                 449,724 bytes
     5: uds_vehicle_config_2025_01_22_16_42_06_ecu_id.blf                 195,962 bytes
     6: uds_vehicle_config_2025_01_22_16_59_00_ecu_id.blf                     316 bytes
     7: uds_vehicle_config_2025_01_22_17_00_19_ecu_id.blf               3,032,788 bytes
     8: uds_vehicle_config_2025_01_22_17_03_05_dtc.blf                  3,032,318 bytes
     9: uds_vehicle_config_2025_01_22_17_05_54_testerPresent.blf        3,271,184 bytes
    10: uds_vehicle_config_2025_01_22_17_08_52_sw_ver.blf               3,024,556 bytes

    노트

    • 7: uds_vehicle_config_2025_01_22_17_00_19_ecu_id.blf 3,032,788 bytes
    • 8: uds_vehicle_config_2025_01_22_17_03_05_dtc.blf 3,032,318 bytes
    • 9: uds_vehicle_config_2025_01_22_17_05_54_testerPresent.blf 3,271,184 bytes
    • 10: uds_vehicle_config_2025_01_22_17_08_52_sw_ver.blf 3,024,556 bytes
    • 위 네 파일들이 내가 진단 요청과 응답 메시지들의 m_id 쌍을 찾기 위해서 베뉴에서 측정한 데이터 파일들이다.
    def show_diag_msgs_in_blf(blf) -> (list, list):
        '''
        blf 파일을 읽어서 진단 통신 메시지의 아이디들을 추출한다.
        요청과 응답 메시지들의 m_id 쌍을 리스트로 반환한다.
        펑셔널 요청에 응답하는 m_id들을 리스트로 반환한다.
        처리 결과를 파일에 저장한다. 파일 이름은 blf 파일 이름에 _diag_msgs.txt를 붙인다.
        '''
    
        # blf 파일을 읽는다.
        log = can.io.BLFReader(blf)
        i_msg = 0
        i_diag = 0
    
        # 진단 요청 m_id와 응답 m_id 쌍을 저장할 리스트
        m_id_req_resp_pairs = []
    
        # 펑셔널 요청의 m_id는 0x7DF이다. 스캐닝을 통해서 찾았다.
        m_id_func = 0x7DF
    
        # 펑셔널 요청에 응답하는 m_id를 저장할 리스트
        m_ids_responding_to_functional_request = []
    
        # 결과를 저장할 파일 이름
        output_file = blf.stem + '_diag_msgs.txt'
    
        with open(output_file, 'w') as f:
            # blf 파일의 정보를 출력한다.
            print(f'blf: {blf.name:60} {blf.stat().st_size:12,} bytes\n', file=f)
    
            for msg in log:
    
                # 진단 통신 메시지만 처리한다.
                # 진단 통신 메시지의 m_id는 0x700 이상이다.
                # 요청 메시지는 Tx, 응답 메시지는 Rx이다.
                # Read Data By Identifier (ECU ID, Software Version), Read DTC, Tester Present 요청으로 스캐닝을 하였다. 
    
                # 요청 메시지를 찾는다.
                if (msg.arbitration_id >= 0x700) and (not msg.is_rx):
                    i_diag += 1
                    if (msg.data[1] == 0x22):   # Read Data By Identifier
                        if (msg.data[2] == 0xF1) and (msg.data[3] == 0x00):    # Read ECU ID
                            diag_req = 'Read ECU ID'
                        elif (msg.data[2] == 0x10) and (msg.data[3] == 0x00):  # Read Sotware Version 
                            diag_req = 'Read Software Version'
                    elif (msg.data[1] == 0x19):    # Read DTC
                        diag_req = 'Read DTC'
                    elif (msg.data[1] == 0x3E):    # Tester Present
                        diag_req = 'Tester Present'
                    else:    # Unknown
                        diag_req = 'Unknown'
    
                    i_msg_prev = i_msg
                    msg_prev = msg
    
                # 응답 메시지를 찾는다.
                if (msg.arbitration_id >= 0x700) and (msg.is_rx):
                    # TP (Transport Protocol)의 PCI (Protocol Control Information)를 확인한다.
                    pci = msg.data[0] & 0xF0
                    if pci == 0x20: # Consecutive Frame
                        if msg_prev.arbitration_id == m_id_func:
                            m_ids_responding_to_functional_request.append(msg.arbitration_id)
                        else:
                            m_id_req_resp_pairs.append((msg_prev.arbitration_id, msg.arbitration_id))
                        print(f'{i_msg:10,} {msg.timestamp:12.6f} {msg.arbitration_id:4X} {msg.dlc:2} {"R" if msg.is_rx else "T":2} {msg.data.hex()}', file=f)
                    else: # Single Frame 혹은 First Frame
                        if msg_prev.arbitration_id == m_id_func:
                            m_ids_responding_to_functional_request.append(msg.arbitration_id)
                        else:
                            m_id_req_resp_pairs.append((msg_prev.arbitration_id, msg.arbitration_id))
                        print('', file=f)
                        print(f'{i_diag = :,}', file=f)
                        print(f'{diag_req = }', file=f)
                        print(f'{i_msg_prev:10,} {msg_prev.timestamp:12.6f} {msg_prev.arbitration_id:4X} {msg_prev.dlc:2} {"R" if msg_prev.is_rx else "T":2} {msg_prev.data.hex()}', file=f)
                        print(f'{i_msg:10,} {msg.timestamp:12.6f} {msg.arbitration_id:4X} {msg.dlc:2} {"R" if msg.is_rx else "T":2} {msg.data.hex()}', file=f)
    
                i_msg += 1
    
            print('', file=f)
            m_id_req_resp_pairs = list(set(m_id_req_resp_pairs))
            print(f'{len(m_id_req_resp_pairs) = }', file=f)
            for req_resp_pair in m_id_req_resp_pairs:
                print(f'{req_resp_pair[0]:X} {req_resp_pair[1]:X}', file=f)
            print('', file=f)
    
            # m_id_func에 대한 응답을 하는 m_id를 표시한다.
            m_ids_responding_to_functional_request = list(set(m_ids_responding_to_functional_request))
            m_ids_responding_to_functional_request.sort()
            print(f'{len(m_ids_responding_to_functional_request) = }', file=f)
            for i_resp_m_id, resp_m_id in enumerate(m_ids_responding_to_functional_request):
                print(f'{resp_m_id:X}', end=' ', file=f)
                if i_resp_m_id % 10 == 9:
                    print('', file=f)
            print('', file=f)
    
    
        return m_id_req_resp_pairs, m_ids_responding_to_functional_request
    

    Read ECU ID 요청으로 스캐닝한 결과

    # Read ECU ID 요청으로 스캐닝한 결과
    i = 7
    blf = blfs[i]
    m_id_req_resp_pairs, m_ids_responding_to_functional_request = show_diag_msgs_in_blf(blf)
    output_file = blf.stem + '_diag_msgs.txt'
    
    os.system(f'code {output_file}')
    blf: uds_vehicle_config_2025_01_22_17_00_19_ecu_id.blf               3,032,788 bytes
    
    
    i_diag = 113
    diag_req = 'Read ECU ID'
       158,702 1737532878.536868  770  8 T  0322f100aaaaaaaa
       158,719 1737532878.541945  778  8 R  0562f1003139aaaa
    
    i_diag = 151
    diag_req = 'Read ECU ID'
       209,813 1737532897.537085  796  8 T  0322f100aaaaaaaa
       209,844 1737532897.546770  79E  8 R  100f62f100302e33
       209,871 1737532897.557017  79E  8 R  2100000000000000
       209,895 1737532897.566246  79E  8 R  220000aaaaaaaaaa
    
    i_diag = 162
    diag_req = 'Read ECU ID'
       223,265 1737532902.537219  7A0  8 T  0322f100aaaaaaaa
       223,312 1737532902.552653  7A8  8 R  0662f100323230aa
    
    i_diag = 181
    diag_req = 'Read ECU ID'
       248,823 1737532912.037412  7B3  8 T  0322f100aaaaaaaa
       248,881 1737532912.059555  7BB  8 R  103462f100515820
       248,932 1737532912.078467  7BB  8 R  2120202039373235
       248,987 1737532912.099339  7BB  8 R  22302d4b32333030
       249,047 1737532912.118339  7BB  8 R  234845415445522d
       249,098 1737532912.138337  7BB  8 R  24434f4e54524f4c
       249,153 1737532912.158353  7BB  8 R  2520464154432056
       249,203 1737532912.178342  7BB  8 R  26312d30322d3930
       249,259 1737532912.198436  7BB  8 R  27332d3030000000
    
    i_diag = 198
    diag_req = 'Read ECU ID'
       270,352 1737532920.038124  7C3  8 T  0322f100aaaaaaaa
       270,369 1737532920.043579  7CB  8 R  037f2231aaaaaaaa
    
    i_diag = 199
    diag_req = 'Read ECU ID'
       271,696 1737532920.537619  7C4  8 T  0322f100aaaaaaaa
       271,753 1737532920.557346  7CC  8 R  103362f100515820
       271,830 1737532920.587527  7CC  8 R  21204d4643202041
       271,850 1737532920.595073  7CC  8 R  2254204b4f52204c
       271,878 1737532920.605256  7CC  8 R  23484420312e3030
       271,924 1737532920.618545  7CC  8 R  2420312e30312039
       271,950 1737532920.627570  7CC  8 R  25393231312d4b32
       271,966 1737532920.635087  7CC  8 R  2631303020323130
       272,006 1737532920.647348  7CC  8 R  27333239aaaaaaaa
    
    i_diag = 202
    diag_req = 'Read ECU ID'
       274,395 1737532921.537563  7C6  8 T  0322f100aaaaaaaa
       274,466 1737532921.563581  7CE  8 R  0662f10039343100
    
    i_diag = 213
    diag_req = 'Read ECU ID'
       289,193 1737532927.037844  7D1  8 T  0322f100aaaaaaaa
       289,196 1737532927.040193  7D9  8 R  101e62f100515820
       289,215 1737532927.045148  7D9  8 R  2145534320052031
       289,225 1737532927.047493  7D9  8 R  2230301904012035
       289,230 1737532927.048569  7D9  8 R  23383931302d4b32
       289,231 1737532927.049116  7D9  8 R  24353030aaaaaaaa
    
    i_diag = 215
    diag_req = 'Read ECU ID'
       290,541 1737532927.537609  7D2  8 T  0322f100aaaaaaaa
       290,571 1737532927.547420  7DA  8 R  037f2211aaaaaaaa
    
    i_diag = 217
    diag_req = 'Read ECU ID'
       293,232 1737532928.537602  7D4  8 T  0322f100aaaaaaaa
       293,250 1737532928.544053  7DC  8 R  102862f100515820
       293,281 1737532928.553349  7DC  8 R  21204d4450532043
       293,308 1737532928.563718  7DC  8 R  2220312e30302031
       293,333 1737532928.573333  7DC  8 R  232e303620353633
       293,359 1737532928.583741  7DC  8 R  2434302d4b323030
       293,389 1737532928.594353  7DC  8 R  25302030423036aa
    
    i_diag = 229
    diag_req = 'Read ECU ID'
       308,036 1737532934.037806  7DF  8 T  0322f100aaaaaaaa
       308,040 1737532934.040506  7D9  8 R  101e62f100515820
    
    i_diag = 229
    diag_req = 'Read ECU ID'
       308,036 1737532934.037806  7DF  8 T  0322f100aaaaaaaa
       308,055 1737532934.044317  79E  8 R  100f62f100302e33
    
    i_diag = 229
    diag_req = 'Read ECU ID'
       308,036 1737532934.037806  7DF  8 T  0322f100aaaaaaaa
       308,057 1737532934.044727  7DC  8 R  102862f100515820
    
    i_diag = 232
    diag_req = 'Unknown'
       308,071 1737532934.048039  7DF  8 T  300000aaaaaaaaaa
       308,073 1737532934.048509  7E9  8 R  102562f100505342
    
    i_diag = 233
    diag_req = 'Unknown'
       308,076 1737532934.049679  7DF  8 T  300000aaaaaaaaaa
       308,091 1737532934.053798  7A8  8 R  0662f100323230aa
    
    i_diag = 233
    diag_req = 'Unknown'
       308,076 1737532934.049679  7DF  8 T  300000aaaaaaaaaa
       308,092 1737532934.054034  7CC  8 R  103362f100515820
    
    i_diag = 235
    diag_req = 'Read ECU ID'
       309,390 1737532934.537818  7E0  8 T  0322f100aaaaaaaa
       309,437 1737532934.554055  7E8  8 R  037f2231aaaaaaaa
    
    i_diag = 252
    diag_req = 'Read ECU ID'
       332,259 1737532943.038165  7F1  8 T  0322f100aaaaaaaa
       332,276 1737532943.044582  7F9  8 R  037f2222aaaaaaaa
    
    len(m_id_req_resp_pairs) = 12
    7C4 7CC
    770 778
    7F1 7F9
    7D4 7DC
    796 79E
    7D1 7D9
    7E0 7E8
    7C3 7CB
    7B3 7BB
    7C6 7CE
    7A0 7A8
    7D2 7DA
    
    len(m_ids_responding_to_functional_request) = 6
    79E 7A8 7CC 7D9 7DC 7E9 

    노트

    • 진단 요청과 응답 m_id 짝을 12개 찾았다.
    • Read ECU ID 펑셔널 진단 요청에 응답하는 제어기가 6개 있다.
    • 진단 통신 스펙이 있다면 스캐닝을 할 필요가 없었을까? 남의 진단 요청에 응답을 하는 제어기는 없다는 것을 확인하기 위한 목적으로 스캐닝을 검증을 할 필요가 있다고 생각한다.

    Read DTC 요청으로 스캐닝한 결과

    # Read DTC 요청으로 스캐닝한 결과
    i = 8
    blf = blfs[i]
    m_id_req_resp_pairs, m_ids_responding_to_functional_request = show_diag_msgs_in_blf(blf)
    output_file = blf.stem + '_diag_msgs.txt'
    
    os.system(f'code {output_file}')
    blf: uds_vehicle_config_2025_01_22_17_03_05_dtc.blf                  3,032,318 bytes
    
    
    i_diag = 113
    diag_req = 'Read DTC'
       159,760 1737533045.379190  770  8 T  03190209aaaaaaaa
       159,785 1737533045.388531  778  8 R  03590209aaaaaaaa
    
    i_diag = 151
    diag_req = 'Read DTC'
       210,869 1737533064.379317  796  8 T  03190209aaaaaaaa
       210,884 1737533064.385139  79E  8 R  03590208aaaaaaaa
    
    i_diag = 161
    diag_req = 'Read DTC'
       224,320 1737533069.379554  7A0  8 T  03190209aaaaaaaa
       224,411 1737533069.412243  7A8  8 R  037f1978aaaaaaaa
    
    i_diag = 161
    diag_req = 'Read DTC'
       224,320 1737533069.379554  7A0  8 T  03190209aaaaaaaa
       225,069 1737533069.652253  7A8  8 R  03590209aaaaaaaa
    
    i_diag = 180
    diag_req = 'Read DTC'
       249,883 1737533078.880759  7B3  8 T  03190209aaaaaaaa
       249,921 1737533078.893532  7BB  8 R  0359020900000000
    
    i_diag = 196
    diag_req = 'Read DTC'
       271,404 1737533086.881076  7C3  8 T  03190209aaaaaaaa
       271,430 1737533086.891206  7CB  8 R  03590289aaaaaaaa
    
    i_diag = 197
    diag_req = 'Read DTC'
       272,745 1737533087.380728  7C4  8 T  03190209aaaaaaaa
       272,783 1737533087.394194  7CC  8 R  03590209aaaaaaaa
    
    i_diag = 199
    diag_req = 'Read DTC'
       275,436 1737533088.380775  7C6  8 T  03190209aaaaaaaa
       275,462 1737533088.390794  7CE  8 R  0359020800000000
    
    i_diag = 210
    diag_req = 'Read DTC'
       290,237 1737533093.881068  7D1  8 T  03190209aaaaaaaa
       290,244 1737533093.883121  7D9  8 R  03590289aaaaaaaa
    
    i_diag = 211
    diag_req = 'Read DTC'
       291,578 1737533094.380836  7D2  8 T  03190209aaaaaaaa
       291,604 1737533094.391597  7DA  8 R  037f1911aaaaaaaa
    
    i_diag = 213
    diag_req = 'Read DTC'
       294,269 1737533095.380840  7D4  8 T  03190209aaaaaaaa
       294,276 1737533095.383153  7DC  8 R  03590289aaaaaaaa
    
    i_diag = 224
    diag_req = 'Read DTC'
       309,070 1737533100.881805  7DF  8 T  03190209aaaaaaaa
       309,077 1737533100.883492  7DC  8 R  03590289aaaaaaaa
    
    i_diag = 224
    diag_req = 'Read DTC'
       309,070 1737533100.881805  7DF  8 T  03190209aaaaaaaa
       309,081 1737533100.884584  79E  8 R  03590208aaaaaaaa
    
    i_diag = 224
    diag_req = 'Read DTC'
       309,070 1737533100.881805  7DF  8 T  03190209aaaaaaaa
       309,083 1737533100.887905  7E8  8 R  035902ffaaaaaaaa
    
    i_diag = 224
    diag_req = 'Read DTC'
       309,070 1737533100.881805  7DF  8 T  03190209aaaaaaaa
       309,099 1737533100.891644  778  8 R  03590209aaaaaaaa
    
    i_diag = 224
    diag_req = 'Read DTC'
       309,070 1737533100.881805  7DF  8 T  03190209aaaaaaaa
       309,100 1737533100.891872  7CB  8 R  03590289aaaaaaaa
    
    i_diag = 224
    diag_req = 'Read DTC'
       309,070 1737533100.881805  7DF  8 T  03190209aaaaaaaa
       309,111 1737533100.894368  7DA  8 R  03590289aaaaaaaa
    
    i_diag = 224
    diag_req = 'Read DTC'
       309,070 1737533100.881805  7DF  8 T  03190209aaaaaaaa
       309,112 1737533100.894603  7E9  8 R  035902ffaaaaaaaa
    
    i_diag = 224
    diag_req = 'Read DTC'
       309,070 1737533100.881805  7DF  8 T  03190209aaaaaaaa
       309,137 1737533100.903455  7CC  8 R  03590209aaaaaaaa
    
    i_diag = 224
    diag_req = 'Read DTC'
       309,070 1737533100.881805  7DF  8 T  03190209aaaaaaaa
       309,182 1737533100.921660  7A8  8 R  037f1978aaaaaaaa
    
    i_diag = 224
    diag_req = 'Read DTC'
       309,070 1737533100.881805  7DF  8 T  03190209aaaaaaaa
       309,815 1737533101.153816  7A8  8 R  03590209aaaaaaaa
    
    i_diag = 225
    diag_req = 'Read DTC'
       310,405 1737533101.378114  7E0  8 T  03190209aaaaaaaa
       310,431 1737533101.387907  7E8  8 R  035902ffaaaaaaaa
    
    i_diag = 226
    diag_req = 'Read DTC'
       311,777 1737533101.883664  7E1  8 T  03190209aaaaaaaa
       311,797 1737533101.891537  7E9  8 R  035902ffaaaaaaaa
    
    i_diag = 242
    diag_req = 'Read DTC'
       333,276 1737533109.878172  7F1  8 T  03190209aaaaaaaa
       333,303 1737533109.886427  7F9  8 R  037f1911aaaaaaaa
    
    len(m_id_req_resp_pairs) = 13
    7C4 7CC
    770 778
    7F1 7F9
    7D4 7DC
    796 79E
    7D1 7D9
    7E0 7E8
    7C3 7CB
    7B3 7BB
    7C6 7CE
    7A0 7A8
    7E1 7E9
    7D2 7DA
    
    len(m_ids_responding_to_functional_request) = 9
    778 79E 7A8 7CB 7CC 7DA 7DC 7E8 7E9 

    Tester Present 요청으로 스캐닝한 결과

    # Tester Present 요청으로 스캐닝한 결과
    i = 9
    blf = blfs[i]
    m_id_req_resp_pairs, m_ids_responding_to_functional_request = show_diag_msgs_in_blf(blf)
    output_file = blf.stem + '_diag_msgs.txt'
    
    os.system(f'code {output_file}')
    blf: uds_vehicle_config_2025_01_22_17_05_54_testerPresent.blf        3,271,184 bytes
    
    
    i_diag = 113
    diag_req = 'Tester Present'
       164,880 1737533215.991428  770  8 T  023e00aaaaaaaaaa
       164,895 1737533215.996052  778  8 R  027e00aaaaaaaaaa
    
    i_diag = 151
    diag_req = 'Tester Present'
       215,990 1737533234.991562  796  8 T  023e00aaaaaaaaaa
       216,005 1737533234.996617  79E  8 R  027e00aaaaaaaaaa
    
    i_diag = 161
    diag_req = 'Tester Present'
       229,441 1737533239.991909  7A0  8 T  023e00aaaaaaaaaa
       229,467 1737533240.000213  7A8  8 R  037f3e7faaaaaaaa
    
    i_diag = 180
    diag_req = 'Tester Present'
       254,998 1737533249.491842  7B3  8 T  023e00aaaaaaaaaa
       255,025 1737533249.502561  7BB  8 R  027e001200000000
    
    i_diag = 196
    diag_req = 'Tester Present'
       276,520 1737533257.492400  7C3  8 T  023e00aaaaaaaaaa
       276,541 1737533257.500517  7CB  8 R  027e00aaaaaaaaaa
    
    i_diag = 197
    diag_req = 'Tester Present'
       277,865 1737533257.992138  7C4  8 T  023e00aaaaaaaaaa
       277,920 1737533258.012136  7CC  8 R  037f3e7faaaaaaaa
    
    i_diag = 199
    diag_req = 'Tester Present'
       280,556 1737533258.992164  7C6  8 T  023e00aaaaaaaaaa
       280,630 1737533259.019328  7CE  8 R  027e000000000000
    
    i_diag = 210
    diag_req = 'Tester Present'
       295,351 1737533264.492160  7D1  8 T  023e00aaaaaaaaaa
       295,374 1737533264.500166  7D9  8 R  037f3e7faaaaaaaa
    
    i_diag = 211
    diag_req = 'Tester Present'
       296,697 1737533264.992184  7D2  8 T  023e00aaaaaaaaaa
       296,721 1737533265.000522  7DA  8 R  037f3e11aaaaaaaa
    
    i_diag = 213
    diag_req = 'Tester Present'
       299,388 1737533265.992229  7D4  8 T  023e00aaaaaaaaaa
       299,389 1737533265.993969  7DC  8 R  027e00aaaaaaaaaa
    
    i_diag = 224
    diag_req = 'Tester Present'
       314,184 1737533271.492491  7DF  8 T  023e00aaaaaaaaaa
       314,185 1737533271.493977  7DC  8 R  027e00aaaaaaaaaa
    
    i_diag = 224
    diag_req = 'Tester Present'
       314,184 1737533271.492491  7DF  8 T  023e00aaaaaaaaaa
       314,186 1737533271.495287  778  8 R  027e00aaaaaaaaaa
    
    i_diag = 224
    diag_req = 'Tester Present'
       314,184 1737533271.492491  7DF  8 T  023e00aaaaaaaaaa
       314,210 1737533271.501218  7CB  8 R  027e00aaaaaaaaaa
    
    i_diag = 224
    diag_req = 'Tester Present'
       314,184 1737533271.492491  7DF  8 T  023e00aaaaaaaaaa
       314,211 1737533271.501452  7D9  8 R  037f3e7faaaaaaaa
    
    i_diag = 224
    diag_req = 'Tester Present'
       314,184 1737533271.492491  7DF  8 T  023e00aaaaaaaaaa
       314,212 1737533271.501682  7E9  8 R  027e00aaaaaaaaaa
    
    i_diag = 224
    diag_req = 'Tester Present'
       314,184 1737533271.492491  7DF  8 T  023e00aaaaaaaaaa
       314,215 1737533271.502323  79E  8 R  027e00aaaaaaaaaa
    
    i_diag = 224
    diag_req = 'Tester Present'
       314,184 1737533271.492491  7DF  8 T  023e00aaaaaaaaaa
       314,220 1737533271.505283  7E8  8 R  027e00aaaaaaaaaa
    
    i_diag = 224
    diag_req = 'Tester Present'
       314,184 1737533271.492491  7DF  8 T  023e00aaaaaaaaaa
       314,243 1737533271.510678  7CC  8 R  037f3e7faaaaaaaa
    
    i_diag = 225
    diag_req = 'Tester Present'
       315,537 1737533271.992499  7E0  8 T  023e00aaaaaaaaaa
       315,565 1737533272.005291  7E8  8 R  027e00aaaaaaaaaa
    
    i_diag = 226
    diag_req = 'Tester Present'
       316,883 1737533272.492527  7E1  8 T  023e00aaaaaaaaaa
       316,906 1737533272.500653  7E9  8 R  027e00aaaaaaaaaa
    
    i_diag = 242
    diag_req = 'Tester Present'
       338,401 1737533280.492185  7F1  8 T  023e00aaaaaaaaaa
       338,434 1737533280.503009  7F9  8 R  027e00aaaaaaaaaa
    
    len(m_id_req_resp_pairs) = 13
    7C4 7CC
    770 778
    7F1 7F9
    7D4 7DC
    796 79E
    7D1 7D9
    7E0 7E8
    7C3 7CB
    7B3 7BB
    7C6 7CE
    7A0 7A8
    7E1 7E9
    7D2 7DA
    
    len(m_ids_responding_to_functional_request) = 8
    778 79E 7CB 7CC 7D9 7DC 7E8 7E9 

    Read Software Version 요청으로 스캐닝한 결과

    # Read Software Version 요청으로 스캐닝한 결과
    i = 10
    blf = blfs[i]
    m_id_req_resp_pairs, m_ids_responding_to_functional_request = show_diag_msgs_in_blf(blf)
    output_file = blf.stem + '_diag_msgs.txt'
    
    os.system(f'code {output_file}')
    blf: uds_vehicle_config_2025_01_22_17_08_52_sw_ver.blf               3,024,556 bytes
    
    
    i_diag = 113
    diag_req = 'Read Software Version'
       160,031 1737533391.775709  770  8 T  03221000aaaaaaaa
       160,036 1737533391.780312  778  8 R  037f2231aaaaaaaa
    
    i_diag = 151
    diag_req = 'Read Software Version'
       211,141 1737533410.776257  796  8 T  03221000aaaaaaaa
       211,142 1737533410.778332  79E  8 R  037f2231aaaaaaaa
    
    i_diag = 161
    diag_req = 'Read Software Version'
       224,592 1737533415.776354  7A0  8 T  03221000aaaaaaaa
       224,620 1737533415.789010  7A8  8 R  037f2231aaaaaaaa
    
    i_diag = 180
    diag_req = 'Read Software Version'
       250,145 1737533425.276258  7B3  8 T  03221000aaaaaaaa
       250,170 1737533425.288135  7BB  8 R  037f221200000000
    
    i_diag = 196
    diag_req = 'Read Software Version'
       271,667 1737533433.276918  7C3  8 T  03221000aaaaaaaa
       271,691 1737533433.286578  7CB  8 R  037f2231aaaaaaaa
    
    i_diag = 197
    diag_req = 'Read Software Version'
       273,015 1737533433.777223  7C4  8 T  03221000aaaaaaaa
       273,066 1737533433.797157  7CC  8 R  037f2231aaaaaaaa
    
    i_diag = 199
    diag_req = 'Read Software Version'
       275,706 1737533434.777361  7C6  8 T  03221000aaaaaaaa
       275,757 1737533434.797321  7CE  8 R  037f222200000000
    
    i_diag = 210
    diag_req = 'Read Software Version'
       290,500 1737533440.277429  7D1  8 T  03221000aaaaaaaa
       290,501 1737533440.278867  7D9  8 R  037f2231aaaaaaaa
    
    i_diag = 211
    diag_req = 'Read Software Version'
       291,847 1737533440.777392  7D2  8 T  03221000aaaaaaaa
       291,872 1737533440.788388  7DA  8 R  037f2211aaaaaaaa
    
    i_diag = 213
    diag_req = 'Read Software Version'
       294,538 1737533441.777435  7D4  8 T  03221000aaaaaaaa
       294,563 1737533441.787172  7DC  8 R  037f2231aaaaaaaa
    
    i_diag = 224
    diag_req = 'Read Software Version'
       309,331 1737533447.277216  7DF  8 T  03221000aaaaaaaa
       309,334 1737533447.279199  7D9  8 R  037f2222aaaaaaaa
    
    i_diag = 224
    diag_req = 'Read Software Version'
       309,331 1737533447.277216  7DF  8 T  03221000aaaaaaaa
       309,358 1737533447.287853  7CC  8 R  037f2231aaaaaaaa
    
    i_diag = 225
    diag_req = 'Read Software Version'
       310,679 1737533447.777225  7E0  8 T  03221000aaaaaaaa
       310,687 1737533447.783024  7E8  8 R  037f2231aaaaaaaa
    
    i_diag = 226
    diag_req = 'Read Software Version'
       312,024 1737533448.277236  7E1  8 T  03221000aaaaaaaa
       312,049 1737533448.287397  7E9  8 R  037f2231aaaaaaaa
    
    i_diag = 242
    diag_req = 'Read Software Version'
       333,545 1737533456.277598  7F1  8 T  03221000aaaaaaaa
       333,571 1737533456.287844  7F9  8 R  037f2222aaaaaaaa
    
    len(m_id_req_resp_pairs) = 13
    7C4 7CC
    770 778
    7F1 7F9
    7D4 7DC
    796 79E
    7D1 7D9
    7E0 7E8
    7C3 7CB
    7B3 7BB
    7C6 7CE
    7A0 7A8
    7E1 7E9
    7D2 7DA
    
    len(m_ids_responding_to_functional_request) = 2
    7CC 7D9 

    노트

    • Read Software Version 요청의 응답은 모두 부정 응답이다.
    • 나는 표준(Standard)/기본(Default) 모드/세션에서 Read Software Version 요청을 하였다. 모드/세션이 맞지 않아서 부정 응답을 했을 수도 있고, 지원하지 않는 서비스라서 부정 응답을 했을 수도 있다.
      • 부정 응답의 이유 코드가 0x12, 0x31, 0x22, 0x11로 다양하다.

    결론

    • 진단 요청 스캐닝으로 진단 요청 m_id와 응답 m_id 짝을 찾을 수 있다.
    • 진단 요청 스캐닝을 통해서 남의 요청에 응답하는 제어기가 없음을 검증한다.

     

    venue_uds_match_diag_req_resp_m_id_blf.ipynb
    0.01MB

    'application' 카테고리의 다른 글

    DID(data identifier) 스캐닝  (0) 2025.01.27
    진단 응답 해석하기  (1) 2025.01.26
    진단 통신으로 제어기 확인하기  (0) 2025.01.26
    dbc에서 m_id들을 찾기  (0) 2025.01.26
    차량 형상 점검  (0) 2025.01.19