I am trying to get diagnostic data from ECU. I've tried an example but nothing works out, it always throws some exceptions. I am using VN5620 as a CAN Interface. I tried using the raw send command example code
import uds
from uds import Uds
PCM = Uds(transportProtocol="CAN", interface="vector", reqId=0x1C440019, resId=0x1C460019, appName="pythonUds", channel=1)
a = PCM.send([0x22, 0x02, 0x00])
Traceback (most recent call last):
File "C:\workspace\companion_chip_automation\Tests\UdsOnCanTest\python_uds.py", line 4, in <module>
PCM = Uds(transportProtocol="CAN", interface="vector", reqId=0x1C440019, resId=0x1C460019, appName="pythonUds", channel=1)
File "C:\workspace\venv_3.8\lib\site-packages\uds\uds_communications\Uds\Uds.py", line 43, in __init__
self.tp = tpFactory(self.__transportProtocol, configPath=configPath, **kwargs)
File "C:\workspace\venv_3.8\lib\site-packages\uds\uds_communications\TransportProtocols\TpFactory.py", line 37, in __call__
return CanTp(configPath=configPath, **kwargs)
File "C:\workspace\venv_3.8\lib\site-packages\uds\uds_communications\TransportProtocols\Can\CanTp.py", line 96, in __init__
self.__connection = canConnectionFactory(self.callback_onReceive,
File "C:\workspace\venv_3.8\lib\site-packages\uds\uds_communications\TransportProtocols\Can\CanConnectionFactory.py", line 17, in __call__
CanConnectionFactory.checkKwargs(**kwargs)
File "C:\workspace\venv_3.8\lib\site-packages\uds\uds_communications\TransportProtocols\Can\CanConnectionFactory.py", line 91, in checkKwargs
CanConnectionFactory.config['vector']['channel'] = kwargs['channel']
File "C:\Program Files\Python38\lib\configparser.py", line 1258, in __setitem__
self._parser._validate_value_types(option=key, value=value)
File "C:\Program Files\Python38\lib\configparser.py", line 1185, in _validate_value_types
raise TypeError("option values must be strings")
TypeError: option values must be strings
Could you help me to get the first response and solve this issue?
Thanks
First off, actual error feels like its a bug in the python-uds. What you are passing to the Uds gets stored in ConfigParser and that's where the exception is thrown from.
Second, the error says "option values must be strings" and few rows above gives a hint that the issue is with kwargs['channel']. You are passing channel=1
. So, given this; maybe passing channel="1"
would fix the issue?