christoph2 / pyxcp

ASAM XCP in Python
http://pyxcp.rtfd.org
GNU Lesser General Public License v3.0
207 stars 64 forks source link

ERR_CMD_UNKNOWN #146

Open oleid opened 1 year ago

oleid commented 1 year ago

Hey,

I'm trying to connect to a device via XCP/TCP and get a crash due to an unknown command:

$ python xcphello.py -c conf_eth.toml  -d -l DEBUG
DEBUG:pyxcp.transport.Base:CONNECT
DEBUG:pyxcp.transport.Base:-> [02 00 00 00 ff 00]
DEBUG:pyxcp.transport.Base:<- L8 C605 [ff 04 81 fe 02 00 01 01]
DEBUG:pyxcp.transport.Base:GET_COMM_MODE_INFO
DEBUG:pyxcp.transport.Base:-> [01 00 01 00 fb]
DEBUG:pyxcp.transport.Base:<- L8 C606 [ff 04 00 fe 00 00 00 15]
DEBUG:pyxcp.transport.Base:GET_ID
DEBUG:pyxcp.transport.Base:-> [02 00 02 00 fa 01]
DEBUG:pyxcp.transport.Base:<- L2 C607 [fe 20]
ERROR:pyxcp.errorhandler:XcpResponseError [ERR_CMD_UNKNOWN]
Try to handle error -- Service: GET_ID Error-Code: ERR_CMD_UNKNOWN
ERROR:pyXCP:Traceback (most recent call last):
  File "/home/user/src/pyxcp/pyxcp/examples/xcphello.py", line 33, in <module>
    identifier = x.identifier(0x01)
                 ^^^^^^^^^^^^^^^^^^
  File "/home/user/venv/lib/python3.11/site-packages/pyxcp/master/master.py", line 1821, in identifier
    gid = self.getId(id_value)
          ^^^^^^^^^^^^^^^^^^^^
  File "/home/user/venv/lib/python3.11/site-packages/pyxcp/master/errorhandler.py", line 398, in inner
    res = executor(inst, func, arguments)

I'm new to the XCP world, so any pointers would be highly appreciated.

Thanks a lot!

christoph2 commented 1 year ago

Just comment out # identifier = x.identifier(0x01) and three lines below # print(f"ID: '{identifier}'")

While optional, XCP slaves usually ship with a GET_ID implementation -- this is not the case here. You may also try the --daq-info option. python xcphello.py -c conf_eth.toml -d -l DEBUG --daq-info If there is a ERR_ACCESS_LOCKED error, just ask.