Skip to content
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

Bytearray index out of range #180

Open
mannyOaks opened this issue Oct 30, 2024 · 9 comments
Open

Bytearray index out of range #180

mannyOaks opened this issue Oct 30, 2024 · 9 comments

Comments

@mannyOaks
Copy link

mannyOaks commented Oct 30, 2024

Hi, I'm currently using pyxcp to read some signal's values using DAQ, but ran into a "bytearray index out of range" error that makes me unable to read the values.

image
As you can see in this image, response is an empty bytearray, but data is a bytearray of length 1799.

Here is the script I'm running that gets me this error

config = {
    "HOST": hostname,
    "PORT": port,
    "PROTOCOL": "udp",
    "CREATE_DAQ_TIMESTAMPS": True,
}

x = Master("eth", config=config)
a2l = A2lParser(a2l_path)

x.connect()

DAQ_LIST_NUMBER = 0
BIT_OFFSET = 255
MAX_ENTRY_SIZE = 255
DAQ_MODE_TIME_OFF = 0x0
DAQ_START_STOP_LIST_MODE = 0x02
STOP_SYNCH_MODE = 0x0
START_SYNCH_MODE = 0x1

# MAX_DTO value is 1438 in my ECU
MAX_DTO = x.slaveProperties.maxDto

signal = XcpUtils.get_attribute_dict_from_a2l_list(a2l.variable_list, signal_name)
data_type = DataType(signal.get("data_type"))
length = XcpHelper.calculate_signal_length_with_data_type(data_type.size, signal.get("matrix_dim"))
# Length of this specific signal is 3136, meaning we need 3 tables
odt_tables_count = math.ceil(length / (MAX_DTO - 1))

MAX_SIZE = MAX_DTO - 1
odt_matrix = []
for _ in range(odt_tables_count):
    matrix_size = sum(sum(e) for e in odt_matrix)
    if matrix_size + MAX_SIZE > length:
        entry_size = length - matrix_size
    else:
        entry_size = MAX_SIZE

    entries = []
    while entry_size > 0:
        if entry_size > MAX_ENTRY_SIZE:
            size = MAX_ENTRY_SIZE
        else:
            size = entry_size

        entry_size -= size
        entries.append(size)
    odt_matrix.append(entries)
# odt_matrix = [
#   [255, 255, 255, 255, 255, 162],
#   [255, 255, 255, 255, 255, 162],
#   [255, 7],
# ]

event = XcpUtils.get_attribute_dict_from_a2l_list(a2l.event_list, event_name)
event_channel_number = event.get("channel_number")

x.freeDaq()
x.allocDaq(1)  # Only one list
x.allocOdt(DAQ_LIST_NUMBER, odt_tables_count)

for odt_number, entries in enumerate(odt_matrix):
    x.allocOdtEntry(DAQ_LIST_NUMBER, odt_number, len(entries))

ecu_address = signal.get("ecu_address")
for odt_number, entries in enumerate(odt_matrix):
    x.setDaqPtr(DAQ_LIST_NUMBER, odt_number, 0)
    for entry_size in entries:
        x.writeDaq(
            BIT_OFFSET,
            entry_size,
            signal.get("address_ext"),
            ecu_address,
        )
        ecu_address += entry_size

x.setDaqListMode(DAQ_MODE_TIME_OFF, DAQ_LIST_NUMBER, event_channel_number, 1, 0)
x.startStopDaqList(DAQ_START_STOP_LIST_MODE, DAQ_LIST_NUMBER)

x.startStopSynch(START_SYNCH_MODE)
x.startStopSynch(STOP_SYNCH_MODE)

x.disconnect()

I'm running commands in the same order as Vector's CANape, and CANape does return some values with the same signal I'm reading in this script, any ideas what might I be doing wrong?

Python version, OS and pyxcp version:
image
image
image

@christoph2
Copy link
Owner

OK, this is mainly a documentation issue, i.e. my fault...

The complete DAQ process -- setup, ODT allocation and recording is part of pyXCP; the example file run_daq.py is exactly what you are you looking for.

There is some documentation in form of this discussion (will be reworked to offical documentation soon).

@mannyOaks
Copy link
Author

mannyOaks commented Oct 31, 2024

Unfortunately, I had already tried that approach and this was the output:

[2024-10-31 12:49:11,265][INFO] - XCPonEth - Connected to: 10.1.0.34:30444  local address: 10.1.0.46:58123 [AF_INET][SOCK_DGRAM]
[2024-10-31 12:49:11,265][DEBUG] - CONNECT
[2024-10-31 12:49:11,265][DEBUG] - -> [02 00 00 00 ff 00]
[2024-10-31 12:49:11,270][DEBUG] - <- L8 C12275 [ff 05 40 40 9e 05 01 01]
[2024-10-31 12:49:11,274][DEBUG] - GET_STATUS
[2024-10-31 12:49:11,274][DEBUG] - -> [01 00 01 00 fd]
[2024-10-31 12:49:11,275][DEBUG] - <- L6 C12276 [ff 00 00 00 00 00]
setup DAQ lists.
[2024-10-31 12:49:11,276][DEBUG] - GET_DAQ_PROCESSOR_INFO
[2024-10-31 12:49:11,276][DEBUG] - -> [01 00 02 00 da]
[2024-10-31 12:49:11,280][DEBUG] - <- L8 C12277 [ff 83 ff ff 12 00 00 20]
[2024-10-31 12:49:11,281][DEBUG] - GET_DAQ_RESOLUTION_INFO
[2024-10-31 12:49:11,281][DEBUG] - -> [01 00 03 00 d9]
[2024-10-31 12:49:11,286][DEBUG] - <- L8 C12278 [ff 01 ff 01 ff 00 00 00]
[2024-10-31 12:49:11,286][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,286][DEBUG] - -> [04 00 04 00 d7 00 00 00]
[2024-10-31 12:49:11,290][DEBUG] - <- L7 C12279 [ff 04 01 07 01 07 8b]
[2024-10-31 12:49:11,291][DEBUG] - UPLOAD
[2024-10-31 12:49:11,291][DEBUG] - -> [02 00 05 00 f5 07]
[2024-10-31 12:49:11,295][DEBUG] - <- L8 C12280 [ff 43 30 5f 31 30 4d 53]
[2024-10-31 12:49:11,296][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,296][DEBUG] - -> [04 00 06 00 d7 00 01 00]
[2024-10-31 12:49:11,300][DEBUG] - <- L7 C12281 [ff 04 01 07 02 07 8a]
[2024-10-31 12:49:11,300][DEBUG] - UPLOAD
[2024-10-31 12:49:11,300][DEBUG] - -> [02 00 07 00 f5 07]
[2024-10-31 12:49:11,305][DEBUG] - <- L8 C12282 [ff 43 30 5f 32 30 4d 53]
[2024-10-31 12:49:11,306][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,306][DEBUG] - -> [04 00 08 00 d7 00 02 00]
[2024-10-31 12:49:11,310][DEBUG] - <- L7 C12283 [ff 04 01 09 01 08 89]
[2024-10-31 12:49:11,311][DEBUG] - UPLOAD
[2024-10-31 12:49:11,311][DEBUG] - -> [02 00 09 00 f5 09]
[2024-10-31 12:49:11,316][DEBUG] - <- L10 C12284 [ff 43 30 5f 42 47 54 41 53 4b]
[2024-10-31 12:49:11,317][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,317][DEBUG] - -> [04 00 0a 00 d7 00 03 00]
[2024-10-31 12:49:11,321][DEBUG] - <- L7 C12285 [ff 04 01 07 01 07 8b]
[2024-10-31 12:49:11,321][DEBUG] - UPLOAD
[2024-10-31 12:49:11,321][DEBUG] - -> [02 00 0b 00 f5 07]
[2024-10-31 12:49:11,325][DEBUG] - <- L8 C12286 [ff 43 31 5f 31 30 4d 53]
[2024-10-31 12:49:11,326][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,326][DEBUG] - -> [04 00 0c 00 d7 00 04 00]
[2024-10-31 12:49:11,331][DEBUG] - <- L7 C12287 [ff 04 01 06 05 06 8c]
[2024-10-31 12:49:11,332][DEBUG] - UPLOAD
[2024-10-31 12:49:11,332][DEBUG] - -> [02 00 0d 00 f5 06]
[2024-10-31 12:49:11,335][DEBUG] - <- L7 C12288 [ff 43 31 5f 35 4d 53]
[2024-10-31 12:49:11,335][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,335][DEBUG] - -> [04 00 0e 00 d7 00 05 00]
[2024-10-31 12:49:11,340][DEBUG] - <- L7 C12289 [ff 04 01 07 02 07 8a]
[2024-10-31 12:49:11,340][DEBUG] - UPLOAD
[2024-10-31 12:49:11,340][DEBUG] - -> [02 00 0f 00 f5 07]
[2024-10-31 12:49:11,345][DEBUG] - <- L8 C12290 [ff 43 31 5f 32 30 4d 53]
[2024-10-31 12:49:11,345][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,346][DEBUG] - -> [04 00 10 00 d7 00 06 00]
[2024-10-31 12:49:11,350][DEBUG] - <- L7 C12291 [ff 04 01 08 01 08 89]
[2024-10-31 12:49:11,351][DEBUG] - UPLOAD
[2024-10-31 12:49:11,351][DEBUG] - -> [02 00 11 00 f5 08]
[2024-10-31 12:49:11,355][DEBUG] - <- L9 C12292 [ff 43 31 5f 31 30 30 4d 53]
[2024-10-31 12:49:11,356][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,357][DEBUG] - -> [04 00 12 00 d7 00 07 00]
[2024-10-31 12:49:11,360][DEBUG] - <- L7 C12293 [ff 04 01 09 01 08 88]
[2024-10-31 12:49:11,361][DEBUG] - UPLOAD
[2024-10-31 12:49:11,361][DEBUG] - -> [02 00 13 00 f5 09]
[2024-10-31 12:49:11,365][DEBUG] - <- L10 C12294 [ff 43 31 5f 42 47 54 41 53 4b]
[2024-10-31 12:49:11,365][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,366][DEBUG] - -> [04 00 14 00 d7 00 08 00]
[2024-10-31 12:49:11,370][DEBUG] - <- L7 C12295 [ff 04 01 08 01 08 88]
[2024-10-31 12:49:11,370][DEBUG] - UPLOAD
[2024-10-31 12:49:11,370][DEBUG] - -> [02 00 15 00 f5 08]
[2024-10-31 12:49:11,375][DEBUG] - <- L9 C12296 [ff 43 32 5f 31 30 30 4d 53]
[2024-10-31 12:49:11,376][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,376][DEBUG] - -> [04 00 16 00 d7 00 09 00]
[2024-10-31 12:49:11,381][DEBUG] - <- L7 C12297 [ff 04 01 07 01 07 8b]
[2024-10-31 12:49:11,381][DEBUG] - UPLOAD
[2024-10-31 12:49:11,381][DEBUG] - -> [02 00 17 00 f5 07]
[2024-10-31 12:49:11,386][DEBUG] - <- L8 C12298 [ff 43 32 5f 31 30 4d 53]
[2024-10-31 12:49:11,386][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,386][DEBUG] - -> [04 00 18 00 d7 00 0a 00]
[2024-10-31 12:49:11,390][DEBUG] - <- L7 C12299 [ff 04 01 07 02 07 8a]
[2024-10-31 12:49:11,390][DEBUG] - UPLOAD
[2024-10-31 12:49:11,390][DEBUG] - -> [02 00 19 00 f5 07]
[2024-10-31 12:49:11,395][DEBUG] - <- L8 C12300 [ff 43 32 5f 32 30 4d 53]
[2024-10-31 12:49:11,396][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,396][DEBUG] - -> [04 00 1a 00 d7 00 0b 00]
[2024-10-31 12:49:11,400][DEBUG] - <- L7 C12301 [ff 04 01 06 05 06 8c]
[2024-10-31 12:49:11,400][DEBUG] - UPLOAD
[2024-10-31 12:49:11,400][DEBUG] - -> [02 00 1b 00 f5 06]
[2024-10-31 12:49:11,406][DEBUG] - <- L7 C12302 [ff 43 32 5f 35 4d 53]
[2024-10-31 12:49:11,406][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,406][DEBUG] - -> [04 00 1c 00 d7 00 0c 00]
[2024-10-31 12:49:11,411][DEBUG] - <- L7 C12303 [ff 04 01 07 04 07 89]
[2024-10-31 12:49:11,411][DEBUG] - UPLOAD
[2024-10-31 12:49:11,411][DEBUG] - -> [02 00 1d 00 f5 07]
[2024-10-31 12:49:11,416][DEBUG] - <- L8 C12304 [ff 43 32 5f 34 30 4d 53]
[2024-10-31 12:49:11,416][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,416][DEBUG] - -> [04 00 1e 00 d7 00 0d 00]
[2024-10-31 12:49:11,420][DEBUG] - <- L7 C12305 [ff 04 01 09 01 08 87]
[2024-10-31 12:49:11,420][DEBUG] - UPLOAD
[2024-10-31 12:49:11,420][DEBUG] - -> [02 00 1f 00 f5 09]
[2024-10-31 12:49:11,425][DEBUG] - <- L10 C12306 [ff 43 32 5f 42 47 54 41 53 4b]
[2024-10-31 12:49:11,425][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,425][DEBUG] - -> [04 00 20 00 d7 00 0e 00]
[2024-10-31 12:49:11,430][DEBUG] - <- L7 C12307 [ff 04 01 08 01 08 88]
[2024-10-31 12:49:11,430][DEBUG] - UPLOAD
[2024-10-31 12:49:11,430][DEBUG] - -> [02 00 21 00 f5 08]
[2024-10-31 12:49:11,436][DEBUG] - <- L9 C12308 [ff 43 33 5f 31 30 30 4d 53]
[2024-10-31 12:49:11,436][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,436][DEBUG] - -> [04 00 22 00 d7 00 0f 00]
[2024-10-31 12:49:11,440][DEBUG] - <- L7 C12309 [ff 04 01 07 01 07 8b]
[2024-10-31 12:49:11,441][DEBUG] - UPLOAD
[2024-10-31 12:49:11,441][DEBUG] - -> [02 00 23 00 f5 07]
[2024-10-31 12:49:11,445][DEBUG] - <- L8 C12310 [ff 43 33 5f 31 30 4d 53]
[2024-10-31 12:49:11,446][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,446][DEBUG] - -> [04 00 24 00 d7 00 10 00]
[2024-10-31 12:49:11,451][DEBUG] - <- L7 C12311 [ff 04 01 07 02 07 8a]
[2024-10-31 12:49:11,451][DEBUG] - UPLOAD
[2024-10-31 12:49:11,451][DEBUG] - -> [02 00 25 00 f5 07]
[2024-10-31 12:49:11,455][DEBUG] - <- L8 C12312 [ff 43 33 5f 32 30 4d 53]
[2024-10-31 12:49:11,456][DEBUG] - GET_DAQ_EVENT_INFO
[2024-10-31 12:49:11,456][DEBUG] - -> [04 00 26 00 d7 00 11 00]
[2024-10-31 12:49:11,460][DEBUG] - <- L7 C12313 [ff 04 01 09 01 08 89]
[2024-10-31 12:49:11,461][DEBUG] - UPLOAD
[2024-10-31 12:49:11,461][DEBUG] - -> [02 00 27 00 f5 09]
[2024-10-31 12:49:11,465][DEBUG] - <- L10 C12314 [ff 43 33 5f 42 47 54 41 53 4b]
[2024-10-31 12:49:11,466][DEBUG] - FREE_DAQ
[2024-10-31 12:49:11,466][DEBUG] - -> [01 00 28 00 d6]
[2024-10-31 12:49:11,470][DEBUG] - <- L1 C12315 [ff]
[2024-10-31 12:49:11,471][DEBUG] - ALLOC_DAQ
[2024-10-31 12:49:11,471][DEBUG] - -> [04 00 29 00 d5 00 01 00]
[2024-10-31 12:49:11,475][DEBUG] - <- L1 C12316 [ff]
[2024-10-31 12:49:11,476][DEBUG] - ALLOC_ODT
[2024-10-31 12:49:11,476][DEBUG] - -> [05 00 2a 00 d4 00 00 00 01]
[2024-10-31 12:49:11,481][DEBUG] - <- L1 C12317 [ff]
[2024-10-31 12:49:11,481][DEBUG] - ALLOC_ODT_ENTRY
[2024-10-31 12:49:11,481][DEBUG] - -> [06 00 2b 00 d3 00 00 00 00 01]
[2024-10-31 12:49:11,486][DEBUG] - <- L1 C12318 [ff]
[2024-10-31 12:49:11,486][DEBUG] - SET_DAQ_PTR
[2024-10-31 12:49:11,486][DEBUG] - -> [06 00 2c 00 e2 00 00 00 00 00]
[2024-10-31 12:49:11,490][DEBUG] - <- L1 C12319 [ff]
[2024-10-31 12:49:11,491][DEBUG] - WRITE_DAQ
[2024-10-31 12:49:11,491][DEBUG] - -> [08 00 2d 00 e1 ff 04 00 94 7e d1 9b]
[2024-10-31 12:49:11,495][DEBUG] - <- L1 C12320 [ff]
[2024-10-31 12:49:11,496][DEBUG] - SET_DAQ_LIST_MODE
[2024-10-31 12:49:11,496][DEBUG] - -> [08 00 2e 00 e0 00 00 00 00 00 01 ff]
[2024-10-31 12:49:11,500][DEBUG] - <- L1 C12321 [ff]
[2024-10-31 12:49:11,500][DEBUG] - START_STOP_DAQ_LIST
[2024-10-31 12:49:11,501][DEBUG] - -> [04 00 2f 00 de 02 00 00]
[2024-10-31 12:49:11,505][DEBUG] - <- L2 C12322 [ff 00]
terminate called after throwing an instance of 'std::runtime_error'
  what():  Invalid timestamp size
Aborted

Created a pyxcp_conf.py file out of:

TRANSPORT = "ETH"
HOST = "HOSTNAME"
PORT = 1111
PROTOCOL = "UDP"
IPV6 = false
CREATE_DAQ_TIMESTAMPS = false

And this is the script I ran:

ap = ArgumentParser(description="DAQ test")

a2l = A2lParser(a2l_path)
signal = XcpUtils.get_attribute_dict_from_a2l_list(a2l.variable_list, signal_name)
event = XcpUtils.get_attribute_dict_from_a2l_list(a2l.event_list, event_name)

daq_lists = [
    DaqList(
        "part_1",
        event.get("channel_number"),
        False,
        False,
        [
            (signal_name, signal.get("ecu_address"), 0, "U32"),
        ],
    )
]

daq_parser = DaqRecorder(daq_lists, "run_daq", 1)  # Record to ".xmraw" file.

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(10)  # Run for 10 seconds.

    print("Stop DAQ....")
    daq_parser.stop()
    print("finalize DAQ lists.\n")
    x.disconnect()

@christoph2
Copy link
Owner

The timestamping code at this point is brand new; I didn't test the "no-timestamping" case; this is (hopefully) fixed now.

@mannyOaks
Copy link
Author

Thanks! Seems to be running correctly, just a question about decoding, I used the Decoder example you have in this discussion, and ran into an issue, the measurement I'm reading is an array of size 784, but it only is giving me an array of size 1, is there a way to get the full array?
image

Using this script

ap = ArgumentParser(description="DAQ test")

a2l = A2lParser(a2l_path)
signal = XcpUtils.get_attribute_dict_from_a2l_list(a2l.variable_list, signal_name)
event = XcpUtils.get_attribute_dict_from_a2l_list(a2l.event_list, event_name)

daq_lists = [
    DaqList(
        "part_1",
        event.get("channel_number"),
        False,
        False,
        [
            (signal_name, signal.get("ecu_address"), 0, "U32"),
        ],
    )
]

# daq_parser = DaqToCsv(daq_lists)  # Record to CSV file(s).
daq_parser = DaqRecorder(daq_lists, "run_daq", 1)  # Record to ".xmraw" file.

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(1)  # Run for 1 second.

    print("Stop DAQ....")
    daq_parser.stop()
    print("finalize DAQ lists.\n")
    x.disconnect()

    # print(x.transport.policy.daqQueue)


class Decoder(XcpLogFileDecoder):
    def __init__(self, recording_file_name: str) -> None:
        """
        Regular Python constructor, gets the file name of the recording.
        At this point you may set an output file name, e.g.

        self.my_file_name = Path(recording_file_name).with_suffix(".txt")
        """
        super().__init__(recording_file_name)
        self.data = []

    def initialize(self) -> None:
        """
        Here you may create files, objects, ...
        """

    def finalize(self) -> None:
        """
        Close files, and the like at this stage.
        """

    def on_daq_list(
        self, daq_list_num: int, timestamp0: int, timestamp1: int, measurements: list
    ) -> None:
        """
        As you may guess, this is called on every finished DAQ-list.
        """
        print("measurements", measurements)


decoder = Decoder("run_daq.xmraw")
res = decoder.run()

Got this output:

[2024-11-05 13:38:56,657][DEBUG] - CONNECT
[2024-11-05 13:38:56,658][DEBUG] - -> [02 00 00 00 ff 00]
[2024-11-05 13:38:56,662][DEBUG] - <- L8 C7468 [ff 05 40 40 9e 05 01 01]
[2024-11-05 13:38:56,666][DEBUG] - GET_STATUS
[2024-11-05 13:38:56,666][DEBUG] - -> [01 00 01 00 fd]
[2024-11-05 13:38:56,667][DEBUG] - <- L6 C7469 [ff 00 00 00 00 00]
setup DAQ lists.
[2024-11-05 13:38:56,668][DEBUG] - GET_DAQ_PROCESSOR_INFO
[2024-11-05 13:38:56,668][DEBUG] - -> [01 00 02 00 da]
[2024-11-05 13:38:56,673][DEBUG] - <- L8 C7470 [ff 83 ff ff 12 00 00 20]
[2024-11-05 13:38:56,673][DEBUG] - GET_DAQ_RESOLUTION_INFO
[2024-11-05 13:38:56,673][DEBUG] - -> [01 00 03 00 d9]
[2024-11-05 13:38:56,678][DEBUG] - <- L8 C7471 [ff 01 ff 01 ff 00 00 00]
[2024-11-05 13:38:56,678][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,678][DEBUG] - -> [04 00 04 00 d7 00 00 00]
[2024-11-05 13:38:56,683][DEBUG] - <- L7 C7472 [ff 04 01 07 01 07 8b]
[2024-11-05 13:38:56,683][DEBUG] - UPLOAD
[2024-11-05 13:38:56,683][DEBUG] - -> [02 00 05 00 f5 07]
[2024-11-05 13:38:56,688][DEBUG] - <- L8 C7473 [ff 43 30 5f 31 30 4d 53]
[2024-11-05 13:38:56,689][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,689][DEBUG] - -> [04 00 06 00 d7 00 01 00]
[2024-11-05 13:38:56,692][DEBUG] - <- L7 C7474 [ff 04 01 07 02 07 8a]
[2024-11-05 13:38:56,692][DEBUG] - UPLOAD
[2024-11-05 13:38:56,692][DEBUG] - -> [02 00 07 00 f5 07]
[2024-11-05 13:38:56,697][DEBUG] - <- L8 C7475 [ff 43 30 5f 32 30 4d 53]
[2024-11-05 13:38:56,698][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,698][DEBUG] - -> [04 00 08 00 d7 00 02 00]
[2024-11-05 13:38:56,702][DEBUG] - <- L7 C7476 [ff 04 01 09 01 08 89]
[2024-11-05 13:38:56,703][DEBUG] - UPLOAD
[2024-11-05 13:38:56,703][DEBUG] - -> [02 00 09 00 f5 09]
[2024-11-05 13:38:56,708][DEBUG] - <- L10 C7477 [ff 43 30 5f 42 47 54 41 53 4b]
[2024-11-05 13:38:56,708][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,708][DEBUG] - -> [04 00 0a 00 d7 00 03 00]
[2024-11-05 13:38:56,713][DEBUG] - <- L7 C7478 [ff 04 01 07 01 07 8b]
[2024-11-05 13:38:56,713][DEBUG] - UPLOAD
[2024-11-05 13:38:56,713][DEBUG] - -> [02 00 0b 00 f5 07]
[2024-11-05 13:38:56,718][DEBUG] - <- L8 C7479 [ff 43 31 5f 31 30 4d 53]
[2024-11-05 13:38:56,718][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,718][DEBUG] - -> [04 00 0c 00 d7 00 04 00]
[2024-11-05 13:38:56,722][DEBUG] - <- L7 C7480 [ff 04 01 06 05 06 8c]
[2024-11-05 13:38:56,723][DEBUG] - UPLOAD
[2024-11-05 13:38:56,723][DEBUG] - -> [02 00 0d 00 f5 06]
[2024-11-05 13:38:56,727][DEBUG] - <- L7 C7481 [ff 43 31 5f 35 4d 53]
[2024-11-05 13:38:56,728][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,728][DEBUG] - -> [04 00 0e 00 d7 00 05 00]
[2024-11-05 13:38:56,732][DEBUG] - <- L7 C7482 [ff 04 01 07 02 07 8a]
[2024-11-05 13:38:56,733][DEBUG] - UPLOAD
[2024-11-05 13:38:56,733][DEBUG] - -> [02 00 0f 00 f5 07]
[2024-11-05 13:38:56,738][DEBUG] - <- L8 C7483 [ff 43 31 5f 32 30 4d 53]
[2024-11-05 13:38:56,738][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,738][DEBUG] - -> [04 00 10 00 d7 00 06 00]
[2024-11-05 13:38:56,743][DEBUG] - <- L7 C7484 [ff 04 01 08 01 08 89]
[2024-11-05 13:38:56,743][DEBUG] - UPLOAD
[2024-11-05 13:38:56,743][DEBUG] - -> [02 00 11 00 f5 08]
[2024-11-05 13:38:56,747][DEBUG] - <- L9 C7485 [ff 43 31 5f 31 30 30 4d 53]
[2024-11-05 13:38:56,748][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,748][DEBUG] - -> [04 00 12 00 d7 00 07 00]
[2024-11-05 13:38:56,753][DEBUG] - <- L7 C7486 [ff 04 01 09 01 08 88]
[2024-11-05 13:38:56,753][DEBUG] - UPLOAD
[2024-11-05 13:38:56,753][DEBUG] - -> [02 00 13 00 f5 09]
[2024-11-05 13:38:56,757][DEBUG] - <- L10 C7487 [ff 43 31 5f 42 47 54 41 53 4b]
[2024-11-05 13:38:56,758][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,758][DEBUG] - -> [04 00 14 00 d7 00 08 00]
[2024-11-05 13:38:56,762][DEBUG] - <- L7 C7488 [ff 04 01 08 01 08 88]
[2024-11-05 13:38:56,763][DEBUG] - UPLOAD
[2024-11-05 13:38:56,763][DEBUG] - -> [02 00 15 00 f5 08]
[2024-11-05 13:38:56,767][DEBUG] - <- L9 C7489 [ff 43 32 5f 31 30 30 4d 53]
[2024-11-05 13:38:56,768][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,768][DEBUG] - -> [04 00 16 00 d7 00 09 00]
[2024-11-05 13:38:56,773][DEBUG] - <- L7 C7490 [ff 04 01 07 01 07 8b]
[2024-11-05 13:38:56,774][DEBUG] - UPLOAD
[2024-11-05 13:38:56,774][DEBUG] - -> [02 00 17 00 f5 07]
[2024-11-05 13:38:56,777][DEBUG] - <- L8 C7491 [ff 43 32 5f 31 30 4d 53]
[2024-11-05 13:38:56,778][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,778][DEBUG] - -> [04 00 18 00 d7 00 0a 00]
[2024-11-05 13:38:56,782][DEBUG] - <- L7 C7492 [ff 04 01 07 02 07 8a]
[2024-11-05 13:38:56,783][DEBUG] - UPLOAD
[2024-11-05 13:38:56,783][DEBUG] - -> [02 00 19 00 f5 07]
[2024-11-05 13:38:56,788][DEBUG] - <- L8 C7493 [ff 43 32 5f 32 30 4d 53]
[2024-11-05 13:38:56,788][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,788][DEBUG] - -> [04 00 1a 00 d7 00 0b 00]
[2024-11-05 13:38:56,792][DEBUG] - <- L7 C7494 [ff 04 01 06 05 06 8c]
[2024-11-05 13:38:56,793][DEBUG] - UPLOAD
[2024-11-05 13:38:56,793][DEBUG] - -> [02 00 1b 00 f5 06]
[2024-11-05 13:38:56,797][DEBUG] - <- L7 C7495 [ff 43 32 5f 35 4d 53]
[2024-11-05 13:38:56,797][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,798][DEBUG] - -> [04 00 1c 00 d7 00 0c 00]
[2024-11-05 13:38:56,802][DEBUG] - <- L7 C7496 [ff 04 01 07 04 07 89]
[2024-11-05 13:38:56,803][DEBUG] - UPLOAD
[2024-11-05 13:38:56,803][DEBUG] - -> [02 00 1d 00 f5 07]
[2024-11-05 13:38:56,808][DEBUG] - <- L8 C7497 [ff 43 32 5f 34 30 4d 53]
[2024-11-05 13:38:56,809][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,809][DEBUG] - -> [04 00 1e 00 d7 00 0d 00]
[2024-11-05 13:38:56,813][DEBUG] - <- L7 C7498 [ff 04 01 09 01 08 87]
[2024-11-05 13:38:56,813][DEBUG] - UPLOAD
[2024-11-05 13:38:56,814][DEBUG] - -> [02 00 1f 00 f5 09]
[2024-11-05 13:38:56,818][DEBUG] - <- L10 C7499 [ff 43 32 5f 42 47 54 41 53 4b]
[2024-11-05 13:38:56,818][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,818][DEBUG] - -> [04 00 20 00 d7 00 0e 00]
[2024-11-05 13:38:56,822][DEBUG] - <- L7 C7500 [ff 04 01 08 01 08 88]
[2024-11-05 13:38:56,823][DEBUG] - UPLOAD
[2024-11-05 13:38:56,823][DEBUG] - -> [02 00 21 00 f5 08]
[2024-11-05 13:38:56,828][DEBUG] - <- L9 C7501 [ff 43 33 5f 31 30 30 4d 53]
[2024-11-05 13:38:56,828][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,828][DEBUG] - -> [04 00 22 00 d7 00 0f 00]
[2024-11-05 13:38:56,832][DEBUG] - <- L7 C7502 [ff 04 01 07 01 07 8b]
[2024-11-05 13:38:56,833][DEBUG] - UPLOAD
[2024-11-05 13:38:56,833][DEBUG] - -> [02 00 23 00 f5 07]
[2024-11-05 13:38:56,838][DEBUG] - <- L8 C7503 [ff 43 33 5f 31 30 4d 53]
[2024-11-05 13:38:56,839][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,839][DEBUG] - -> [04 00 24 00 d7 00 10 00]
[2024-11-05 13:38:56,843][DEBUG] - <- L7 C7504 [ff 04 01 07 02 07 8a]
[2024-11-05 13:38:56,843][DEBUG] - UPLOAD
[2024-11-05 13:38:56,843][DEBUG] - -> [02 00 25 00 f5 07]
[2024-11-05 13:38:56,848][DEBUG] - <- L8 C7505 [ff 43 33 5f 32 30 4d 53]
[2024-11-05 13:38:56,848][DEBUG] - GET_DAQ_EVENT_INFO
[2024-11-05 13:38:56,848][DEBUG] - -> [04 00 26 00 d7 00 11 00]
[2024-11-05 13:38:56,852][DEBUG] - <- L7 C7506 [ff 04 01 09 01 08 89]
[2024-11-05 13:38:56,853][DEBUG] - UPLOAD
[2024-11-05 13:38:56,853][DEBUG] - -> [02 00 27 00 f5 09]
[2024-11-05 13:38:56,858][DEBUG] - <- L10 C7507 [ff 43 33 5f 42 47 54 41 53 4b]
[2024-11-05 13:38:56,858][DEBUG] - FREE_DAQ
[2024-11-05 13:38:56,859][DEBUG] - -> [01 00 28 00 d6]
[2024-11-05 13:38:56,862][DEBUG] - <- L1 C7508 [ff]
[2024-11-05 13:38:56,863][DEBUG] - ALLOC_DAQ
[2024-11-05 13:38:56,863][DEBUG] - -> [04 00 29 00 d5 00 01 00]
[2024-11-05 13:38:56,868][DEBUG] - <- L1 C7509 [ff]
[2024-11-05 13:38:56,868][DEBUG] - ALLOC_ODT
[2024-11-05 13:38:56,868][DEBUG] - -> [05 00 2a 00 d4 00 00 00 01]
[2024-11-05 13:38:56,873][DEBUG] - <- L1 C7510 [ff]
[2024-11-05 13:38:56,873][DEBUG] - ALLOC_ODT_ENTRY
[2024-11-05 13:38:56,873][DEBUG] - -> [06 00 2b 00 d3 00 00 00 00 01]
[2024-11-05 13:38:56,878][DEBUG] - <- L1 C7511 [ff]
[2024-11-05 13:38:56,878][DEBUG] - SET_DAQ_PTR
[2024-11-05 13:38:56,878][DEBUG] - -> [06 00 2c 00 e2 00 00 00 00 00]
[2024-11-05 13:38:56,883][DEBUG] - <- L1 C7512 [ff]
[2024-11-05 13:38:56,883][DEBUG] - WRITE_DAQ
[2024-11-05 13:38:56,883][DEBUG] - -> [08 00 2d 00 e1 ff 04 00 94 7e d1 9b]
[2024-11-05 13:38:56,887][DEBUG] - <- L1 C7513 [ff]
[2024-11-05 13:38:56,888][DEBUG] - SET_DAQ_LIST_MODE
[2024-11-05 13:38:56,888][DEBUG] - -> [08 00 2e 00 e0 00 00 00 0a 00 01 ff]
[2024-11-05 13:38:56,893][DEBUG] - <- L1 C7514 [ff]
[2024-11-05 13:38:56,893][DEBUG] - START_STOP_DAQ_LIST
[2024-11-05 13:38:56,893][DEBUG] - -> [04 00 2f 00 de 02 00 00]
[2024-11-05 13:38:56,897][DEBUG] - <- L2 C7515 [ff 00]
start DAQ lists.
[2024-11-05 13:38:56,898][DEBUG] - START_STOP_SYNCH
[2024-11-05 13:38:56,898][DEBUG] - -> [02 00 30 00 dd 01]
[2024-11-05 13:38:56,903][DEBUG] - <- L1 C7516 [ff]
[2024-11-05 13:38:56,913][DEBUG] - <- L5 C7517 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:56,933][DEBUG] - <- L5 C7518 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:56,952][DEBUG] - <- L5 C7519 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:56,972][DEBUG] - <- L5 C7520 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:56,993][DEBUG] - <- L5 C7521 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,013][DEBUG] - <- L5 C7522 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,033][DEBUG] - <- L5 C7523 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,053][DEBUG] - <- L5 C7524 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,073][DEBUG] - <- L5 C7525 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,093][DEBUG] - <- L5 C7526 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,113][DEBUG] - <- L5 C7527 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,133][DEBUG] - <- L5 C7528 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,153][DEBUG] - <- L5 C7529 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,172][DEBUG] - <- L5 C7530 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,193][DEBUG] - <- L5 C7531 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,213][DEBUG] - <- L5 C7532 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,233][DEBUG] - <- L5 C7533 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,253][DEBUG] - <- L5 C7534 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,273][DEBUG] - <- L5 C7535 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,293][DEBUG] - <- L5 C7536 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,312][DEBUG] - <- L5 C7537 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,332][DEBUG] - <- L5 C7538 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,353][DEBUG] - <- L5 C7539 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,373][DEBUG] - <- L5 C7540 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,393][DEBUG] - <- L5 C7541 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,413][DEBUG] - <- L5 C7542 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,433][DEBUG] - <- L5 C7543 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,453][DEBUG] - <- L5 C7544 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,472][DEBUG] - <- L5 C7545 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,493][DEBUG] - <- L5 C7546 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,513][DEBUG] - <- L5 C7547 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,533][DEBUG] - <- L5 C7548 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,553][DEBUG] - <- L5 C7549 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,573][DEBUG] - <- L5 C7550 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,592][DEBUG] - <- L5 C7551 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,613][DEBUG] - <- L5 C7552 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,632][DEBUG] - <- L5 C7553 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,653][DEBUG] - <- L5 C7554 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,673][DEBUG] - <- L5 C7555 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,693][DEBUG] - <- L5 C7556 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,713][DEBUG] - <- L5 C7557 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,733][DEBUG] - <- L5 C7558 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,752][DEBUG] - <- L5 C7559 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,773][DEBUG] - <- L5 C7560 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,792][DEBUG] - <- L5 C7561 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,812][DEBUG] - <- L5 C7562 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,833][DEBUG] - <- L5 C7563 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,852][DEBUG] - <- L5 C7564 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,873][DEBUG] - <- L5 C7565 ODT_Data[0:8] [00 00 00 00 00]
[2024-11-05 13:38:57,893][DEBUG] - <- L5 C7566 ODT_Data[0:8] [00 00 00 00 00]
Stop DAQ....
[2024-11-05 13:38:57,904][DEBUG] - START_STOP_SYNCH
[2024-11-05 13:38:57,904][DEBUG] - -> [02 00 31 00 dd 00]
[2024-11-05 13:38:57,907][DEBUG] - <- L1 C7567 [ff]
finalize DAQ lists.

[2024-11-05 13:38:57,908][DEBUG] - DISCONNECT
[2024-11-05 13:38:57,908][DEBUG] - -> [01 00 32 00 fe]
[2024-11-05 13:38:57,913][DEBUG] - <- L1 C7568 [ff]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
measurements [0]
None

@mannyOaks
Copy link
Author

Also, is there a way to run the Master object without using the ArgumentParser (aka not making a cli)?
Tried importing the pyxcp_conf.py file but I get an import error saying get_config is not defined.
image

@christoph2
Copy link
Owner

christoph2 commented Nov 6, 2024

Hi,

There's currently no built-in support for arrays, but this is a good point; I think, this feature could be easily added.

For now you may try the following code:

TYPE_SIZES = {
    "U8": 1,
    "I8": 1,
    "U16": 2,
    "I16": 2,
    "U32": 4,
    "I32": 4,
    "U64": 8,
    "I64": 8,
    "F32": 4,
    "F64": 8,
}

def create_array(name, tp: str, base_addr: int, addr_ext: 0, arr_size: int):
    result = []
    addr = base_addr
    type_size = TYPE_SIZES[tp]
    for idx in range(arr_size):
        result.append((f"{name}[{idx}]", addr, addr_ext, tp))
        addr += type_size
    return result

DAQ_LISTS = [
    DaqList(
        "array_quantity",
        1,
        False,
        True,
        create_array("array", "I32", 0x4711, 0, 16)  # just as example...
    )
]

But note:

  • With large DAQ lists you may hit a limit of your XCP slave (re-configuration, if possible, may required), so you better start with, say 8 or 16 elements.
  • Identifiers like array[3] are meaningful, but may cause problems elsewhere.
  • loglevel DEBUG has an adverse effect on performance and may cause communication problems (e.g. timeouts).
  • There is a bunch of example files (starting with ex_), demonstrating how-to extract the recordings from .xmraw to ASAM MDF, Arrow/Parquet, CSV, Excel workbook, resp. SQLite3.

Honestly, I don't understand why you want to bypass ArgumentParser, which is technically the interface to traitlets configuration handling.

@mannyOaks
Copy link
Author

Can confirm the above example, works, thanks for answering!
image

My reasoning for bypassing the ArgumentParser, is that at the moment I'm working directly with a Master object, and changing to using the context from the ArgumentParser would require quite a bit of rework on my end, it's not really a need or anything like that, was more like to see if there was a way to use it without using it as a context obj

@mannyOaks
Copy link
Author

Also, is it possible to set the daq lists after the daq parser was set in AP.run(policy=daq_parser)? Recently came into an issue that my A2L file had set the wrong channel numbers and as a workaround I'm using the index from the channels list that are available using x.getDaqInfo

@JavierCorado
Copy link

JavierCorado commented Nov 26, 2024

I am also facing the same issue with the ArgumentParser, I think that it would be valuable to have the option to use the Master object directly rather than rely on the ArgumentParser completely.

This is one of the reasons why I still use v0.21.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants