richClubb / python-uds

A uds library for python
MIT License
95 stars 54 forks source link

UDS connection via CAN ,self.tp.recv time out waiting for message #57

Open saheelsikander opened 3 years ago

saheelsikander commented 3 years ago

Hello Richard,

i was trying python-ids , but unfortunately with the documents and example provided i am not able to establish connection, code snippet and error log is shown below, appreciate your help in solving this issue .

Code: import can from uds import Uds

test1 = Uds(transportProtocol="CAN",reqId=0x600, resId=0x650, bustype="vector",device="CAN",appName="pythonUds",channel="0")

print(dir(test1))

esnRaw = test1.send([0x22, 0xF1, 0x8C]) print(esnRaw)

This sends the request for Ecu Serial N

Error: Traceback (most recent call last): File "D:\Python_Learning\Diagnostics.py", line 7, in esnRaw = test1.send([0x22, 0xF1, 0x8C]) File "C:\Users\ssikander\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uds\uds_communications\Uds\Uds.py", line 140, in send response = self.tp.recv(self.__P2_CAN_Client) File "C:\Users\ssikander\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uds\uds_communications\TransportProtocols\Can\CanTp.py", line 340, in recv raise Exception("Timeout in waiting for message") Exception: Timeout in waiting for message

richClubb commented 3 years ago

Hi.

First off you're using the ID's that we put in as an example for the Embed E400 bootloader which are atypical for most automotive applications. Usually most vehicles have ReqID and ResID in the range 0x700 - 0x7FF. Do you know what the IDs are of the module you're trying to communicate with? Typically for most cars the PCM (engine ECU) is ReqId: 0x7E0 and ResId: 0x7E8

Could you give me more information on your ECU / network setup?

On Thu, 27 Aug 2020 at 15:03, saheelsikander notifications@github.com wrote:

Hello Richard,

i was trying python-ids , but unfortunately with the documents and example provided i am not able to establish connection, code snippet and error log is shown below, appreciate your help in solving this issue .

Code: import can from uds import Uds

test1 = Uds(transportProtocol="CAN",reqId=0x600, resId=0x650, bustype="vector",device="CAN",appName="pythonUds",channel="0")

print(dir(test1))

esnRaw = test1.send([0x22, 0xF1, 0x8C]) print(esnRaw) This sends the request for Ecu Serial N

Error: Traceback (most recent call last): File "D:\Python_Learning\Diagnostics.py", line 7, in esnRaw = test1.send([0x22, 0xF1, 0x8C]) File "C:\Users\ssikander\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uds\uds_communications\Uds\Uds.py", line 140, in send response = self.tp.recv(self.__P2_CAN_Client) File "C:\Users\ssikander\AppData\Local\Programs\Python\Python38-32\lib\site-packages\uds\uds_communications\TransportProtocols\Can\CanTp.py", line 340, in recv raise Exception("Timeout in waiting for message") Exception: Timeout in waiting for message

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/richClubb/python-uds/issues/57, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMQRVCRZTC6DRZMDNUEDUDSCZRTZANCNFSM4QNA32CQ .

saheelsikander commented 3 years ago

Hello Richard, I am trying to connect to infotainment ECU with ID's 0x18BA4CF1 ReqID, and 0x18BAF14C ResID

saheelsikander commented 3 years ago

Hello Richard, I am trying to connect to infotainment ECU with ID's 0x18BA4CF1 ReqID, and 0x18BAF14C ResID

saheelsikander commented 3 years ago

Hello Richard, I am trying to connect to infotainment ECU with ID's 0x18BA4CF1 ReqID, and 0x18BAF14C ResID

saheelsikander commented 3 years ago

Hello Richard, I am trying to connect to infotainment ECU with ID's 0x18BA4CF1 ReqID, and 0x18BAF14C ResID

saheelsikander commented 3 years ago

Hello Richard, I am trying to connect to infotainment ECU with ID's 0x18BA4CF1 ReqID, and 0x18BAF14C ResID

saheelsikander commented 3 years ago

Hello Richard, I am trying to connect to infotainment ECU with ID's 0x18BA4CF1 ReqID, and 0x18BAF14C ResID

saheelsikander commented 3 years ago

Hello Richard, I am trying to connect to infotainment ECU with ID's 0x18BA4CF1 ReqID, and 0x18BAF14C ResID

saheelsikander commented 3 years ago

Hello Richard, I am trying to connect to infotainment ECU with ID's 0x18BA4CF1 ReqID, and 0x18BAF14C ResID

saheelsikander commented 3 years ago

Hello Richard, I am trying to connect to infotainment ECU with ID's 0x18BA4CF1 ReqID, and 0x18BAF14C ResID

saheelsikander commented 3 years ago

Hello Richard, I am trying to connect to infotainment ECU with ID's 0x18BA4CF1 ReqID, and 0x18BAF14C ResID

yangyixizg commented 1 year ago

I am facing the same issue. Here am code example: rawEcu = Uds(reqId=0x18DA03F5, resId=0x18DAF503, transportProtocol="CAN", interface="peak") # baudrate="250000" esnRaw = rawEcu.send([0x10, 0x01])

Furthermore, in CanTp.py last line 460, I did following modification for the extended message id: self.__connection.transmit(transmitData, self.__reqId, extended=True)