jacobschaer/python-doipclient

help: [OSError] : Diagnostic request rejected with negative acknowledge code: 3

HRex39 opened this issue · 2 comments

HRex39 commented

Hi Jacob,

I'm just New in DOIP and I've tried some simple code in my vehicle.
I'm not sure why some [OSError] happend since I run my code, did I forget some config or something?

My Code

import udsoncan
from doipclient import DoIPClient
from udsoncan.services import *
from doipclient.connectors import DoIPClientUDSConnector
from udsoncan.client import Client

udsoncan.setup_logging()
ecu_ip = '169.254.1.0'
ecu_logical_address = 0x0C6C
doip_client = DoIPClient(ecu_ip, ecu_logical_address)
print(doip_client.request_vehicle_identification())
uds_connection = DoIPClientUDSConnector(doip_client)
with Client(uds_connection, request_timeout=2) as uds_client:
    uds_client.change_session(DiagnosticSessionControl.Session.extendedDiagnosticSession) # 10 03
   
#    uds_client.tester_present() # 3E 00
#    uds_client.read_data_by_identifier([0x45A8, 0xF190]) # 22 45A8 
doip_client.close()

Outputs

VehicleIdentificationResponse (0x4): { vin: "XXX(for security)", logical_address : 3141, eid : XXX(for security), gid : b'\x00\x00\x00\x00\x00\x00', further_action_required : FurtherActionCodes.NoFurtherActionRequired, vin_sync_status : None }
2023-04-12 18:56:05 [INFO] UdsClient: DiagnosticSessionControl<0x10> - Switching session to extendedDiagnosticSession (0x03)
2023-04-12 18:56:05 [DEBUG] Connection: Sending 2 bytes : [b'1003']
2023-04-12 18:56:05 [ERROR] UdsClient: [OSError] : Diagnostic request rejected with negative acknowledge code: 3     
2023-04-12 18:56:05 [INFO] UdsClient: TesterPresent<0x3e> - Sending TesterPresent request
2023-04-12 18:56:05 [DEBUG] Connection: Sending 2 bytes : [b'3e00']
2023-04-12 18:56:05 [ERROR] UdsClient: [OSError] : Diagnostic request rejected with negative acknowledge code: 3   

Possible incorrect ECU_ logical_ address.

Nack code 3 is enum "UnknownTargetAddress". It doesn't like c6c. This is the ECU not the library.