-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use PyXCP to calibrate and measure an ECU #184
Comments
Here is a general guideline for reading and writing once you successfully stablished connecting with your slave: For reading you have two options, polling and DAQ. If you want to read data through polling you can user the shortUpload and upload methods, the size of the XCP packet determines which one you should use (you can calculate the length of the variable with the data type inside the A2L). For writing, just like in poll based reading you can use shortDownload and download methods (again you have to calculate the size of the XCP packet just like I mentioned above). Just make sure to pack the data with the corresponding length and data type (you can find this information inside the variable definition in the A2L file). Note: Be aware if the signal is an array of values or a single value, this affects the length calculation. |
@JavierCorado Hi thank trying to use this solution for my case(#183) but iam failing with initiate the argument parser: iam requested to create the conf_file: pyxcp_conf.py what should i put there if these are my configurations: send to ECU: can you share an example hoe to initiate https://github.com/christoph2/pyxcp/blob/master/pyxcp/cmdline.py ? |
Well, I've created a small example to show the basic procedure of running a DAQ list measurement (Tested with XCPlite). Note: pya2ldb uses SQLAlchemy under the hood, so arbitrary complex queries are possible, but for the sake of simplicity the example code selects all Tip: There is a small command-line utility xcp_fetch_a2l that can be used to fetch the correspondending A2L file. import time
from pyxcp.cmdline import ArgumentParser
from pyxcp.daq_stim import DaqList, DaqRecorder
from pya2l import DB
from pya2l import model
A2L_FILE = "C_Demo" # No extension -- .a2l is assumed.
db = DB()
session = db.open_create(A2L_FILE) # Import A2L or open existing .a2ldb
ASAM_TYPE_MAP = {
"UBYTE": "U8",
"SBYTE": "I8",
"UWORD": "U16",
"SWORD": "I16",
"ULONG": "U32",
"SLONG": "I32",
"A_UINT64": "U64",
"A_INT64": "I64",
"FLOAT16_IEEE": "F16",
"FLOAT32_IEEE": "F32",
"FLOAT64_IEEE": "F64",
}
measurements = []
for m in session.query(model.Measurement).order_by(model.Measurement.name).all():
name = m.name
address = m.ecu_address.address
address_ext = m.ecu_address_extension.extension if m.ecu_address_extension else 0
asam_type = m.datatype
data_type = ASAM_TYPE_MAP.get(asam_type)
# You may check here if the measurement should be used.
measurements.append((name, address, address_ext, data_type, ))
print(f"MEASUREMENT: {name:<20s} address: 0x{address:08x}:{address_ext} -- type: {asam_type!r}")
ap = ArgumentParser(description="DAQ test")
EVENT_CHANNEL = 0
daq_lists = [
DaqList(
"demo_measurement",
EVENT_CHANNEL,
False, # List is DAQ not STIM.
True, # Use DAQ timestamps if available.
measurements,
)
]
daq_parser = DaqRecorder(daq_lists, "demo_measurement", 1)
with ap.run(policy=daq_parser) as x:
x.connect()
if x.slaveProperties.optionalCommMode:
x.getCommModeInfo()
x.cond_unlock("DAQ") # DAQ resource is locked in many cases.
print("setup DAQ lists.")
daq_parser.setup()
print("start DAQ lists.")
daq_parser.start()
time.sleep(5 * 60) # Run for 5 minutes.
print("Stop DAQ....")
daq_parser.stop()
print("finalize DAQ lists.\n")
x.disconnect() |
Regarding basic setup: First create a configuration file: xcp-profile create -o pyxcp_conf.py Then edit c.Transport.layer="ETH"
c.Transport.Eth.port=5555
c.Transport.Eth.protocol="UDP" # or TCP
c.Transport.Eth.host="localhost" # name or IP of XCP slave
# c.General.seed_n_key_dll="SeedNKeyXcp.dll" # optional name of Seed-and-Key .dll A good starting point is the script xcp_info, which gathers some useful information (If a Seed-and-Key .dll is required, you'll notice here...) |
I forget to mention: The necessary dependencies like |
Hi thanks !! c.Transport.Eth.protocol="UDP" # or TCP c.Transport.Eth.host = "FD53:......slave ip"
|
I use this code: import time
from pyxcp.cmdline import ArgumentParser
from pyxcp.daq_stim import DaqList, DaqRecorder
import logging
logging.basicConfig(level=logging.DEBUG)
# Define measurements directly
measurements = [
("COM_WindowPositionFL", 0x3434CA50, 0, "U8"),
("COM_WindowLockDSBBtnPress", 0x3434CA51, 0, "U8"),
("COM_WindowFRThermalProtect", 0x3434CA52, 0, "U8"),
("COM_WindowFRSuppressionWarn", 0x3434CA53, 0, "U8"),
]
logging.info("DAQ Measurements: %s", measurements)
daq_lists = [
DaqList(
"demo_measurement",
0, # EVENT_CHANNEL
False, # List is DAQ not STIM.
True, # Use DAQ timestamps if available.
measurements,
)
]
logging.info("Init DAQ Argument Parser")
ap = ArgumentParser(description="DAQ test")
daq_parser = DaqRecorder(daq_lists, "demo_measurement", 1)
logging.info("Initialized DAQ Recorder")
try:
with ap.run(policy=daq_parser) as x:
# logging.info("Connecting to ECU...")
x.connect()
# logging.info("Connected to ECU via XCP on CAN")
if x.slaveProperties.optionalCommMode:
x.getCommModeInfo()
x.cond_unlock("DAQ") # Unlock DAQ resource if locked.
# logging.info("Setting up DAQ lists...")
try:
daq_parser.setup()
except Exception as e:
logging.error(f"Failed to setup DAQ lists: {e}")
# logging.info("Starting DAQ...")
daq_parser.start()
time.sleep(60) # Run for 60 seconds.
# logging.info("Stopping DAQ...")
daq_parser.stop()
# logging.info("Finalizing DAQ lists.")
x.disconnect()
except Exception as e:
logging.error(f"An error occurred: {e}") And the result is: PS C:\Tools\ACNI\DAL\utlis> python .\delete_A2L.py
INFO:root:DAQ Measurements: [('COM_WindowPositionFL', 875874896, 0, 'U8'), ('COM_WindowLockDSBBtnPress', 875874897, 0, 'U8'), ('COM_WindowFRThermalProtect', 875874898, 0, 'U8'), ('COM_WindowFRSuppressionWarn', 875874899, 0, 'U8')]
INFO:root:Init DAQ Argument Parser
DEBUG:root:Looking for pyxcp_conf in C:\Tools\ACNI\DAL\utlis
DEBUG:root:Loaded config file: C:\Tools\ACNI\DAL\utlis\pyxcp_conf.py
INFO:root:Initialized DAQ Recorder
INFO:can.interfaces.vector.canlib:Found 12 channels
INFO:can.interfaces.vector.canlib:Channel index 1: VN8917 Channel 1
INFO:can.interfaces.vector.canlib:Channel index 2: VN8917 Channel 2
INFO:can.interfaces.vector.canlib:Channel index 5: VN8917 Channel 5
INFO:can.interfaces.vector.canlib:Channel index 6: VN8917 Channel 6
INFO:can.interfaces.vector.canlib:Channel index 7: VN8917 Channel 7
INFO:can.interfaces.vector.canlib:Channel index 8: VN8917 Channel 8
INFO:can.interfaces.vector.canlib:Channel index 10: Virtual Channel 1
INFO:can.interfaces.vector.canlib:Channel index 11: Virtual Channel 2
DEBUG:can.interface.detect_available_configs:interface "vector" detected 8 available configurations
INFO:root:XCPonCAN - Interface-Type: 'vector' Parameters: [('channel', 0), ('fd', False), ('bitrate', 500000), ('receive_own_messages', False), ('app_name', 'python-can')]
INFO:root:XCPonCAN - Master-ID (Tx): 0x000007B1S -- Slave-ID (Rx): 0x00000782S
DEBUG:can.interfaces.vector.canlib:Channel index 0 found
DEBUG:can.interfaces.vector.canlib:Open Port: PortHandle: 0, ChannelMask: 0x2, PermissionMask: 0x2
INFO:can.interfaces.vector.canlib:xlCanSetChannelBitrate: baudr.=500000
INFO:root:XCPonCAN - Using Interface: 'Application python-can: CAN 1'
INFO:root:XCPonCAN - Filters used: [{'can_id': 1922, 'can_mask': 2047, 'extended': False}]
INFO:root:XCPonCAN - State: BusState.ACTIVE
DEBUG:root:CONNECT
DEBUG:root:-> [ff 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C0 [ff 15 40 08 08 00 01 01]
DEBUG:root:GET_STATUS
DEBUG:root:-> [fd 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C1 [ff 00 00 00 00 00 ff ff]
DEBUG:root:<- L8 C1 [ff 00 00 00 00 00 ff ff]
DEBUG:root:GET_DAQ_PROCESSOR_INFO
DEBUG:root:GET_DAQ_PROCESSOR_INFO
DEBUG:root:-> [da 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C2 [ff 89 06 00 05 00 00 00]
DEBUG:root:GET_DAQ_RESOLUTION_INFO
DEBUG:root:-> [d9 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C3 [ff 01 07 01 00 64 01 00]
DEBUG:root:<- L8 C3 [ff 01 07 01 00 64 01 00]
DEBUG:root:GET_DAQ_EVENT_INFO
DEBUG:root:-> [d7 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C4 [ff 44 01 14 0a 06 09 ff]
DEBUG:root:UPLOAD
DEBUG:root:-> [f5 14]
DEBUG:root:SYNCH
DEBUG:root:-> [fc 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C5 [fe 00 ff ff ff ff ff ff]
ERROR:root:Failed to setup DAQ lists: Failed to retrieve DAQ Info: required argument is not an integer
DEBUG:root:START_STOP_SYNCH
DEBUG:root:-> [dd 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C6 [ff ff ff ff ff ff ff ff]
DEBUG:root:START_STOP_SYNCH
DEBUG:root:-> [dd 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C7 [ff ff ff ff ff ff ff ff]
DEBUG:root:DISCONNECT
DEBUG:root:-> [fe 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C8 [ff ff ff ff ff ff ff ff] After debug, I found the error " Failed to retrieve DAQ Info: required argument is not an integer" occurs in the following function: daq_parser.setup()
self.daq_info = self.xcp_master.getDaqInfo() #daq_stim __init__.py
name = self.fetch(eci.eventChannelNameLength) # master master.py
data = self.upload(remaining) # master master.py
response = self.transport.request(types.Command.UPLOAD, length) # master master.py Currently, I am unable to resolve this issue. Can you help me? |
Is the |
Thanks for your hint. After I removed PS C:\Tools\ACNI\DAL\utlis> python .\delete_A2L.py
INFO:root:DAQ Measurements: [('COM_WindowPositionFL', 875874896, 0, 'U8'), ('COM_WindowLockDSBBtnPress', 875874897, 0, 'U8'), ('COM_WindowFRThermalProtect', 875874898, 0, 'U8'), ('COM_WindowFRSuppressionWarn', 875874899, 0, 'U8')]
INFO:root:Init DAQ Argument Parser
DEBUG:root:Looking for pyxcp_conf in C:\Tools\ACNI\DAL\utlis
DEBUG:root:Loaded config file: C:\Tools\ACNI\DAL\utlis\pyxcp_conf.py
INFO:root:Initialized DAQ Recorder
INFO:can.interfaces.vector.canlib:Found 12 channels
INFO:can.interfaces.vector.canlib:Channel index 1: VN8917 Channel 1
INFO:can.interfaces.vector.canlib:Channel index 2: VN8917 Channel 2
INFO:can.interfaces.vector.canlib:Channel index 5: VN8917 Channel 5
INFO:can.interfaces.vector.canlib:Channel index 6: VN8917 Channel 6
INFO:can.interfaces.vector.canlib:Channel index 7: VN8917 Channel 7
INFO:can.interfaces.vector.canlib:Channel index 8: VN8917 Channel 8
INFO:can.interfaces.vector.canlib:Channel index 10: Virtual Channel 1
INFO:can.interfaces.vector.canlib:Channel index 11: Virtual Channel 2
DEBUG:can.interface.detect_available_configs:interface "vector" detected 8 available configurations
INFO:root:XCPonCAN - Interface-Type: 'vector' Parameters: [('channel', 0), ('fd', False), ('bitrate', 500000), ('receive_own_messages', False), ('app_name', 'python-can')]
INFO:root:XCPonCAN - Master-ID (Tx): 0x000007B1S -- Slave-ID (Rx): 0x00000782S
DEBUG:can.interfaces.vector.canlib:Channel index 0 found
DEBUG:can.interfaces.vector.canlib:Open Port: PortHandle: 0, ChannelMask: 0x2, PermissionMask: 0x2
INFO:can.interfaces.vector.canlib:xlCanSetChannelBitrate: baudr.=500000
INFO:root:XCPonCAN - Using Interface: 'Application python-can: CAN 1'
INFO:root:XCPonCAN - Filters used: [{'can_id': 1922, 'can_mask': 2047, 'extended': False}]
INFO:root:XCPonCAN - State: BusState.ACTIVE
DEBUG:root:CONNECT
DEBUG:root:-> [ff 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C0 [ff 15 40 08 08 00 01 01]
DEBUG:root:GET_STATUS
DEBUG:root:-> [fd 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C1 [ff 00 00 00 00 00 ff ff]
DEBUG:root:GET_DAQ_PROCESSOR_INFO
DEBUG:root:-> [da 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C2 [ff 89 06 00 05 00 00 00]
DEBUG:root:GET_DAQ_RESOLUTION_INFO
DEBUG:root:-> [d9 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C3 [ff 01 07 01 00 64 01 00]
DEBUG:root:GET_DAQ_EVENT_INFO
DEBUG:root:-> [d7 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C4 [ff 44 01 14 0a 06 09 ff]
DEBUG:root:UPLOAD
DEBUG:root:-> [f5 14]
DEBUG:root:SYNCH
DEBUG:root:-> [fc 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C5 [fe 00 ff ff ff ff ff ff]
Adress: None
ERROR:root:Traceback (most recent call last):
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\daq_stim\__init__.py", line 42, in setup
self.daq_info = self.xcp_master.getDaqInfo() #ERROR HERE
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\master.py", line 1732, in getDaqInfo
name = self.fetch(eci.eventChannelNameLength) # ERROR HERE
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\master.py File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\master.py", line 594, in fetch
data = self.upload(remaining) # ERROR HERE
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhandler.py", line 431, in inner
", line 594, in fetch
data = self.upload(remaining) # ERROR HERE
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhandler.py", line 431, in inner
res = executor(inst, func, arguments)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhandler.py", line 431, in inner
res = executor(inst, func, arguments)
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhandler.py", line 431, in inner
res = executor(inst, func, arguments)
ler.py", line 431, in inner
res = executor(inst, func, arguments)
res = executor(inst, func, arguments)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhandler.py", line 363, in __call__
ler.py", line 363, in __call__
res = handler.execute()
^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhandler.py", line 230, in execute
ler.py", line 230, in execute
return self.func(self.instance, *self.arguments.args, **self.arguments.kwargs)
return self.func(self.instance, *self.arguments.args, **self.arguments.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\master.py", line 415, in setMta
addr = self.DWORD_pack(address)
^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: required argument is not an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Tools\ACNI\DAL\utlis\delete_A2L.py", line 49, in <module>
daq_parser.setup()
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\daq_stim\__init__.py", line 44, in setup
raise RuntimeError(f"Failed to retrieve DAQ Info: {e}")
RuntimeError: Failed to retrieve DAQ Info: required argument is not an integer
ERROR:root:An error occurred: Failed to retrieve DAQ Info: required argument is not an integer I saw that variable |
My final proposal is to see the values of all measurements and characteristics on the ECU, which are defined in the A2L file |
Hard to diagnose with zero information...
|
When I try to run PS C:\Tools\ACNI\DAL\utlis> python .\xcp-info.py
2024-12-05 11:05:55 INFO XCPonCAN - Interface-Type: 'vector' Parameters: [('channel', 0), ('fd', False), ('bitrate', 500000), ('receive_own_messages', can.py:333
False), ('app_name', 'python-can')]
INFO XCPonCAN - Master-ID (Tx): 0x000007B1S -- Slave-ID (Rx): 0x00000782S can.py:334
2024-12-05 11:05:56 INFO XCPonCAN - Using Interface: 'Application python-can: CAN 1' can.py:256
INFO XCPonCAN - Filters used: [{'can_id': 1922, 'can_mask': 2047, 'extended': False}] can.py:257
INFO XCPonCAN - State: BusState.ACTIVE can.py:258
Slave Properties:
=================
{'addressGranularity': EnumIntegerString.new(0, 'BYTE'),
'byteOrder': EnumIntegerString.new(0, 'INTEL'),
'bytesPerElement': 1,
'maxCto': 8,
'maxDto': 8,
'maxWriteDaqMultipleElements': 0,
'optionalCommMode': False,
'pgmProcessor': {},
'protocolLayerVersion': 1,
'slaveBlockMode': True,
'supportsCalpag': True,
'supportsDaq': True,
'supportsPgm': True,
'supportsStim': False,
'transportLayerVersion': 1,
'transport_layer': 'CAN'}
Implemented IDs:
================
Protection Status
=================
dbg : False
pgm : False
stim : False
daq : False
calpag: False
DAQ Info:
=========
Adress: None
2024-12-05 11:05:58 ERROR Traceback (most recent call last): master.py:130
File "C:\Tools\ACNI\DAL\utlis\xcp-info.py", line 37, in main
daq_info = x.getDaqInfo()
^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\master.py", line 1732, in
getDaqInfo
name = self.fetch(eci.eventChannelNameLength) # ERROR HERE
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\master.py", line 594, in fetch
data = self.upload(remaining) # ERROR HERE
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhandler.py", line 431, in
inner
res = executor(inst, func, arguments)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhandler.py", line 363, in
__call__
res = handler.execute()
^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhandler.py", line 230, in
execute
return self.func(self.instance, *self.arguments.args, **self.arguments.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\master.py", line 415, in
setMta
addr = self.DWORD_pack(address)
^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: required argument is not an integer
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Tools\ACNI\DAL\utlis\xcp-info.py:109 in <module> │
│ │
│ 106 │
│ 107 │
│ 108 if __name__ == "__main__": │
│ ❱ 109 │ main() │
│ 110 │
│ │
│ C:\Tools\ACNI\DAL\utlis\xcp-info.py:37 in main │
│ │
│ 34 │ │ x.cond_unlock() │
│ 35 │ │ print("\nDAQ Info:") │
│ 36 │ │ print("=========") │
│ ❱ 37 │ │ daq_info = x.getDaqInfo() │
│ 38 │ │ pprint(daq_info) │
│ 39 │ │ │
│ 40 │ │ daq_pro = daq_info["processor"] │
│ │
│ ╭────────────────────────────────────── locals ───────────────────────────────────────╮ │
│ │ ap = <pyxcp.cmdline.ArgumentParser object at 0x000001DC596922D0> │ │
│ │ cps = {'dbg': False, 'pgm': False, 'stim': False, 'daq': False, 'calpag': False} │ │
│ │ k = 'calpag' │ │
│ │ result = {} │ │
│ │ v = False │ │
│ │ x = <pyxcp.master.master.Master object at 0x000001DC5B98B1A0> │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ ... 4 frames hidden ... │
│ │ x = <pyxcp.master.master.Master object at 0x000001DC5B98B1A0> │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ ... 4 frames hidden ... │
│ ╰─────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ ... 4 frames hidden ... │
│ │
│ C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhan │
│ dler.py:230 in execute │
│ │
│ 227 │ │ if isinstance(self.func, types.MethodType): │
│ 228 │ │ │ return self.func(*self.arguments.args, **self.arguments.kwargs) │
│ │
│ C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\errorhan │
│ dler.py:230 in execute │
│ │
│ 227 │ │ if isinstance(self.func, types.MethodType): │
│ 228 │ │ │ return self.func(*self.arguments.args, **self.arguments.kwargs) │
│ dler.py:230 in execute │
│ │
│ 227 │ │ if isinstance(self.func, types.MethodType): │
│ 228 │ │ │ return self.func(*self.arguments.args, **self.arguments.kwargs) │
│ 229 │ │ else: │
│ │
│ 227 │ │ if isinstance(self.func, types.MethodType): │
│ 228 │ │ │ return self.func(*self.arguments.args, **self.arguments.kwargs) │
│ 229 │ │ else: │
│ 227 │ │ if isinstance(self.func, types.MethodType): │
│ 228 │ │ │ return self.func(*self.arguments.args, **self.arguments.kwargs) │
│ 229 │ │ else: │
│ ❱ 230 │ │ │ return self.func(self.instance, *self.arguments.args, **self.arguments.kwarg │
│ 229 │ │ else: │
│ ❱ 230 │ │ │ return self.func(self.instance, *self.arguments.args, **self.arguments.kwarg │
│ ❱ 230 │ │ │ return self.func(self.instance, *self.arguments.args, **self.arguments.kwarg │
│ 231 │ │
│ 232 │ def actions(self, preActions, actions): │
│ 233 │ │ """Preprocess errorhandling pre-actions and actions.""" │
│ │
│ ╭──────────────────────────────── locals ─────────────────────────────────╮ │
│ │ self = <pyxcp.master.errorhandler.Handler object at 0x000001DC5BABE9F0> │ │
│ ╰─────────────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\trangpc\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyxcp\master\master.p │
│ y:415 in setMta │
│ │
│ 412 │ │ """ │
│ 413 │ │ self.mta = types.MtaType(address, addressExt) # Keep track of MTA (needed for e │
│ 414 │ │ print(f"Adress: {address}") │
│ ❱ 415 │ │ addr = self.DWORD_pack(address) │
│ 416 │ │ return self.transport.request(types.Command.SET_MTA, 0, 0, addressExt, *addr) │
│ 417 │ │
│ 418 │ @wrapped │
│ │
│ ╭──────────────────────────────── locals ────────────────────────────────╮ │
│ │ address = None │ │
│ │ addressExt = None │ │
│ │ self = <pyxcp.master.master.Master object at 0x000001DC5B98B1A0> │ │
│ ╰────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
error: required argument is not an integer If you need any additional information, please let me know. |
Maybe really an configuration issues ? Also, to preclude a systematic error of the LEN = 4
ADDR = 4711
x.setMta(ADDR)
data = x.fetch(LEN) |
You should also give XCPlite a chance, to have a working reference system (I'll include a |
Currently, I have three issues that I need your support with.
I resolved the previous issue, but now I’m facing a new problem: I cannot stop the DAQ because DEBUG:root:FREE_DAQ
DEBUG:root:-> [d6 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C8 [ff ff ff ff ff ff ff ff]
dq: b'\x01\x00\x00\x00\x00\x00'
DEBUG:root:ALLOC_DAQ
DEBUG:root:-> [d5 00 01 00 00 00 00 00]
DEBUG:root:<- L8 C9 [ff ff ff ff ff ff ff ff]
DEBUG:root:ALLOC_ODT
DEBUG:root:-> [d4 00 00 00 01 00 00 00]
DEBUG:root:<- L8 C10 [ff ff ff ff ff ff ff ff]
DEBUG:root:ALLOC_ODT_ENTRY
DEBUG:root:-> [d3 00 00 00 00 01 00 00]
DEBUG:root:<- L8 C11 [ff ff ff ff ff ff ff ff]
DEBUG:root:SET_DAQ_PTR
DEBUG:root:-> [e2 00 00 00 00 00 00 00]
DEBUG:root:<- L8 C12 [ff ff ff ff ff ff ff ff]
DEBUG:root:WRITE_DAQ
DEBUG:root:-> [e1 ff 01 00 99 cb 34 34]
DEBUG:root:<- L8 C13 [ff ff ff ff ff ff ff ff]
DEBUG:root:SET_DAQ_LIST_MODE
DEBUG:root:-> [e0 00 00 00 00 00 01 06]
DEBUG:root:<- L8 C14 [ff ff ff ff ff ff ff ff]
DEBUG:root:START_STOP_DAQ_LIST
DEBUG:root:-> [de 02 00 00 00 00 00 00]
DEBUG:root:<- L8 C15 [ff 00 ff ff ff ff ff ff]
Send request startStopSynch
DEBUG:root:START_STOP_SYNCH
DEBUG:root:-> [dd 01 00 00 00 00 00 00]
DEBUG:root:<- L8 C16 [ff ff ff ff ff ff ff ff]
DEBUG:root:<- L8 C17 ODT_Data[0:8] [00 02 ff ff ff ff ff ff]
PS C:\Tools\ACNI\DAL\utlis> Here are the messages on the CAN network for your easier reference: [MASTER]: Timestamp: 1733813801.753901 ID: 7b1 S Rx DL: 8 ff 00 00 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.754621 ID: 782 S Rx DL: 8 ff 15 40 08 08 00 01 01 Channel: 0
[MASTER]: Timestamp: 1733813801.756964 ID: 7b1 S Rx DL: 8 da 00 00 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.764632 ID: 782 S Rx DL: 8 ff 89 06 00 05 00 00 00 Channel: 0
[MASTER]: Timestamp: 1733813801.766844 ID: 7b1 S Rx DL: 8 d9 00 00 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.774618 ID: 782 S Rx DL: 8 ff 01 07 01 00 64 01 00 Channel: 0
[MASTER]: Timestamp: 1733813801.776600 ID: 7b1 S Rx DL: 8 d7 00 00 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.784604 ID: 782 S Rx DL: 8 ff 44 01 14 0a 06 09 ff Channel: 0
[MASTER]: Timestamp: 1733813801.786455 ID: 7b1 S Rx DL: 8 d7 00 01 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.794615 ID: 782 S Rx DL: 8 ff 44 01 14 02 07 08 ff Channel: 0
[MASTER]: Timestamp: 1733813801.796491 ID: 7b1 S Rx DL: 8 d7 00 02 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.804625 ID: 782 S Rx DL: 8 ff 44 01 14 05 07 07 ff Channel: 0
[MASTER]: Timestamp: 1733813801.806649 ID: 7b1 S Rx DL: 8 d7 00 03 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.814603 ID: 782 S Rx DL: 8 ff 44 01 15 01 08 06 ff Channel: 0
[MASTER]: Timestamp: 1733813801.816758 ID: 7b1 S Rx DL: 8 d7 00 04 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.824614 ID: 782 S Rx DL: 8 ff 44 01 12 0a 08 05 ff Channel: 0
[MASTER]: Timestamp: 1733813801.827547 ID: 7b1 S Rx DL: 8 d6 00 00 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.834641 ID: 782 S Rx DL: 8 ff ff ff ff ff ff ff ff Channel: 0
[MASTER]: Timestamp: 1733813801.836304 ID: 7b1 S Rx DL: 8 d5 00 01 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.844635 ID: 782 S Rx DL: 8 ff ff ff ff ff ff ff ff Channel: 0
[MASTER]: Timestamp: 1733813801.846110 ID: 7b1 S Rx DL: 8 d4 00 00 00 01 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.854613 ID: 782 S Rx DL: 8 ff ff ff ff ff ff ff ff Channel: 0
[MASTER]: Timestamp: 1733813801.856292 ID: 7b1 S Rx DL: 8 d3 00 00 00 00 01 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.864615 ID: 782 S Rx DL: 8 ff ff ff ff ff ff ff ff Channel: 0
[MASTER]: Timestamp: 1733813801.866491 ID: 7b1 S Rx DL: 8 e2 00 00 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.874626 ID: 782 S Rx DL: 8 ff ff ff ff ff ff ff ff Channel: 0
[MASTER]: Timestamp: 1733813801.876772 ID: 7b1 S Rx DL: 8 e1 ff 01 00 99 cb 34 34 Channel: 0
[SLAVE]: Timestamp: 1733813801.884637 ID: 782 S Rx DL: 8 ff ff ff ff ff ff ff ff Channel: 0
[MASTER]: Timestamp: 1733813801.886267 ID: 7b1 S Rx DL: 8 e0 00 00 00 00 00 01 06 Channel: 0
[SLAVE]: Timestamp: 1733813801.894614 ID: 782 S Rx DL: 8 ff ff ff ff ff ff ff ff Channel: 0
[MASTER]: Timestamp: 1733813801.896286 ID: 7b1 S Rx DL: 8 de 02 00 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.904609 ID: 782 S Rx DL: 8 ff 00 ff ff ff ff ff ff Channel: 0
[MASTER]: Timestamp: 1733813801.907836 ID: 7b1 S Rx DL: 8 dd 01 00 00 00 00 00 00 Channel: 0
[SLAVE]: Timestamp: 1733813801.914619 ID: 782 S Rx DL: 8 ff ff ff ff ff ff ff ff Channel: 0
[SLAVE]: Timestamp: 1733813801.914898 ID: 782 S Rx DL: 8 00 02 ff ff ff ff ff ff Channel: 0
[SLAVE]: Timestamp: 1733813801.924646 ID: 782 S Rx DL: 8 00 02 ff ff ff ff ff ff Channel: 0
[SLAVE]: Timestamp: 1733813801.934616 ID: 782 S Rx DL: 8 00 02 ff ff ff ff ff ff Channel: 0
[SLAVE]: Timestamp: 1733813801.944618 ID: 782 S Rx DL: 8 00 02 ff ff ff ff ff ff Channel: 0
[SLAVE]: Timestamp: 1733813801.954612 ID: 782 S Rx DL: 8 00 02 ff ff ff ff ff ff Channel: 0
[SLAVE]: Timestamp: 1733813801.964640 ID: 782 S Rx DL: 8 00 02 ff ff ff ff ff ff Channel: 0
[SLAVE]: Timestamp: 1733813801.974626 ID: 782 S Rx DL: 8 00 02 ff ff ff ff ff ff Channel: 0
[SLAVE]: Timestamp: 1733813801.984620 ID: 782 S Rx DL: 8 00 02 ff ff ff ff ff ff Channel: 0
[SLAVE]: Timestamp: 1733813801.994622 ID: 782 S Rx DL: 8 00 02 ff ff ff ff ff ff Channel: 0
[SLAVE]: Timestamp: 1733813802.004633 ID: 782 S Rx DL: 8 00 02 ff ff ff ff ff ff Channel: 0
. . . . . . .
You are helping me a lot with my project. Thank you very much! |
Looks much like that the recorder extension crashes -- this was an older issue., please make sure to use the latest pyXCP version, Coming to your second question: No, it is not required to record first and then do some post-processing; it's also For an example s. DaqToCsv class, you may use this as an starting point. def initialize(self):
pass
def on_daq_list(self, daq_list: int, ts0: int, ts1: int, payload: list):
pass # Live processing here.
def finalize(self):
pass
The parameters of
The conversion routines are included in the fiile unfolder.hpp. ("swordCounter", 0x20414, 0, "I16"),
("sdwordCounter", 0x20418, 0, "I32"),
("channel1", 0x203F8, 0, "F64"),
("channel2", 0x20400, 0, "F64"),
("channel3", 0x20408, 0, "F64"), Conversion is currently not available in the Python space, i.e. only raw byte values from |
@PCT-VF can you share your config file(pyxcp_conf.py)? import time logging.basicConfig(level=logging.DEBUG) Define measurements directlymeasurements = [ logging.info("DAQ Measurements: %s", measurements) daq_lists = [ logging.info("Init DAQ Argument Parser") daq_parser = DaqRecorder(daq_lists, "demo_measurement", 1) try:
except Exception as e: failing on: daq_parser.setup() how can i define it? and what if i dont want to read it from a2l file? |
This is my config in c = get_config() # noqa
c.Transport.layer = 'CAN'
c.Transport.Can.interface = 'vector'
c.Transport.Can.can_id_master = 0x7B1 # Master CAN ID
c.Transport.Can.can_id_slave = 0x782 # Slave CAN ID
c.Transport.Can.channel = 0 # CAN channel (e.g., 0 for Kvaser channel 0)
c.Transport.Can.bitrate = 500000 # CAN bitrate
c.Transport.Can.Vector.app_name = 'python-can' In my code, I define measurement list directly instead of using A2L file, you can use it as a example. measurements = [
("COM_WindowPositionFL", 0x3434CA50, 0, "U8"),
("COM_WindowLockDSBBtnPress", 0x3434CA51, 0, "U8"),
("COM_WindowFRThermalProtect", 0x3434CA52, 0, "U8"),
("COM_WindowFRSuppressionWarn", 0x3434CA53, 0, "U8"),
] I haven't ever seen your error, however, if you provide more infomation, maybe I can help you. |
Hi @PCT-VF thanks again!
logging.basicConfig(level=logging.DEBUG) Define measurements directlymeasurements = [ logging.info("DAQ Measurements: %s", measurements) daq_lists = [ logging.info("Init DAQ Argument Parser") daq_parser = DaqRecorder(daq_lists, "demo_measurement", 1) try:
except Exception as e:
|
I have an A2L file that contains a list of variables and their corresponding 'ECU Addresses.' For example:
https://github.com/christoph2/pyA2L/blob/master/examples/example-a2l-file.a2l.
Now, I need to use CAN XCP to read/write the values of these variables based on their addresses. I have reviewed the examples of PyXCP, but they do not work. Could you help provide an example relevant to my requirements? Thank you very much.
The text was updated successfully, but these errors were encountered: