-
-
Notifications
You must be signed in to change notification settings - Fork 74
Description
We are trying to implement an XCP master using the latest version of the pyxcp library,
communicating with an XCP slave (XCPsim) provided through Vector CANape.
This setup previously worked fine using older pyxcp versions and a JSON configuration file from your examples, where we simply set:
"CAN_DRIVER": "Vector",
"APP_NAME": "XCPsim"
However, after updating to the latest version of pyxcp, the configuration model seems to have changed significantly.
We migrated our setup using a Python-based configuration (pyxcp_config_can.py) instead of the legacy JSON file.
Current Configuration Code
from pyxcp.config import PyXCP, General, Transport
def create_pyxcp_can(
transport: str = "CAN",
interface: str = "vector",
use_default_listener: bool = True,
channel: str = "0",
can_id_master: int = 0x2,
can_id_slave: int = 0x1,
can_id_broadcast: int = 0x100,
max_dlc_required: bool = False,
create_daq_timestamps: bool = False,
app_name: str = "XCPsim",
bitrate: int = 500_000,
data_bitrate: int = 500_000,
disconnect_response_optional: bool = False
) -> PyXCP:
app = PyXCP()
app.general = General(config=app.config, parent=app)
app.transport = Transport(parent=app)
app.general.disconnect_response_optional = disconnect_response_optional
app.transport.layer = transport
app.transport.create_daq_timestamps = create_daq_timestamps
cancfg = app.transport.can
cancfg.interface = interface
cancfg.use_default_listener = use_default_listener
cancfg.channel = channel
cancfg.can_id_master = can_id_master
cancfg.can_id_slave = can_id_slave
cancfg.can_id_broadcast = can_id_broadcast
cancfg.max_dlc_required = max_dlc_required
cancfg.vector.app_name = app_name
cancfg.bitrate = bitrate
cancfg.data_bitrate = data_bitrate
return appIssue 1 – Hardcoded app_name in Vector CAN Interface
To make the connection work, we had to manually change the app_name in the VectorBus class
(located in can.interfaces.vector.canlib) from the hardcoded "CANalyzer" to our required "XCPsim".
Question: Is there a clean way to override the app_name (i.e. the Vector application to attach to)
without modifying the internal source of the library?
Issue 2 – Timeout on connect()
In our main function, we’re initializing and using the master as follows:
app = create_pyxcp_can()
with Master(transport_name="can", config=app, transport_layer_interface=can_if) as xm:
xm.connect()However, the call to xm.connect() always raises a XcpTimeoutError.
XCPsimis running and configured correctly in CANape.- The CAN interface and channel are confirmed to be correct (
channel="0",interface="vector"). - This exact setup worked on the old version of
pyxcp.
Request for Help
- Is there any additional configuration required in the newer
pyxcpversion that we might be missing? - Could the timeout issue be related to recent changes in how Vector CAN interfaces are handled?
- Is there an official way to override the
app_namewithout modifying the library internals?
Any help or guidance would be greatly appreciated.