Skip to content

The error message "7f 36 71" occurs when flashing the application using Service 36 #282

@koukoukkk

Description

@koukoukkk

I really appreciate the library you developed—it works flawlessly, is smooth, and very stable. However, I’ve encountered an issue during usage and hope you can provide some guidance.

When using ​​CAN FD​​, the flashing process completes successfully. But when using ​​CAN​​, while shorter flash packets (for the driver) work fine, the application flashing fails at the first ​​'36 01...'​​ command, returning an error ​​'36 7f 71'​​. I’ve verified that no '36' service message exceeds the maximum allowed length. I tried increasing the override_receiver_stmin​​ parameter, but it didn’t resolve the issue.

Here is my code:

def server_36(response_34_data,block_data,file_list):
    file_path_list = []
    for file in file_list:
        if file.get("file_type") == "XML":
            file_path = analysis_xml(file.get("file_path"))
            for i in range(len(file_path)):
                file_and_sign_list = analysis_xml(file.get("file_path"))
                file_path_list.append(file_and_sign_list[i][0])
        else:
            file_path_list.append(file.get("file_path"))
    total_steps = calculate_steps(file_path_list)  

    max_36 = (int(eval("0x" + response_34_data)))   
    # print("max_36:>>>>>>>>>>>>>>>>>>>>>>>>>>>>", max_36)
    data_bytes = bytes.fromhex(str(block_data.get("data"))[2:-1])  
    sequence_number = 1  

    while len(data_bytes) > 0:
        chunk_size = min(max_36 - 2, len(data_bytes))
        chunk_data = data_bytes[:chunk_size]  
        data_bytes = data_bytes[chunk_size:]  
        print("chunk_data", chunk_data)
        request = TransferData.make_request(sequence_number=sequence_number, data=chunk_data)

        print("client_before>>>>>>>", client)
        client.send_request(request, timeout=8)
        print("client_end>>>>>>>", client)
        print(f"Sent TransferData (sequence_number={sequence_number:02X}, data_length={len(chunk_data)})")
        sequence_number = (sequence_number + 1) % 0x100  
if __name__ == '__main__':
isotp_params = {
    'stmin': 255,
    'blocksize': 8,
    'wftmax': 4095,
    'tx_data_length': 8,
    'tx_data_min_length': 8,
    'tx_padding': 0xCC,
    'rx_flowcontrol_timeout': 5000000,  # +0
    'rx_consecutive_frame_timeout': 5000000,   # +0
    "override_receiver_stmin": 0.002,  # -0
    'max_frame_size': 4095
}
bus = PcanBus(channel="PCAN_USBBUS1", bitrate=500000)
tp_addr = isotp.Address(isotp.AddressingMode.Normal_11bits, txid=0x7E7,rxid=0x7EF)  # Network layer addressing scheme
stack = isotp.CanStack(bus=bus, address=tp_addr, params=isotp_params)
stack.set_sleep_timing(0.02,0.01)
conn = PythonIsoTpConnection(stack)
with Client(conn, request_timeout=10) as client:

.....
Error message:
2025-07-31 11:14:59 [DEBUG] Connection: Sending 11 bytes : [34104470100000000002d2]
2025-07-31 11:14:59 [DEBUG] Connection: Received 4 bytes : [74200802]
2025-07-31 11:14:59 [INFO] UdsClient: Received positive response for service RequestDownload (0x34) from server.
2025-07-31 11:15:00 [DEBUG] Connection: Sending 2050 bytes : [360191d000f8d9ffb4b....]
2025-07-31 11:15:01 [DEBUG] Connection: Received 3 bytes : [7f3671]
Traceback (most recent call last):
File "E:\v7_last\flashtool\common\can\pcan_uds_new.py", line 343, in
server_36(app_response_34_data, block_data, file_list)
File "E:\v7_last\flashtool\common\can\pcan_uds_new.py", line 154, in server_36
client.send_request(request, timeout=8)
File "C:\Users\741170\AppData\Local\Programs\Python\Python310\lib\site-packages\udsoncan\client.py", line 2339, in send_request
raise NegativeResponseException(response)
udsoncan.exceptions.NegativeResponseException: TransferData service execution returned a negative response TransferDataSuspended (0x71)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions