vectorgrp / XCPlite

Simple implementation of the ASAM XCP on Ethernet protocol
MIT License
163 stars 88 forks source link

XcpCreateEvent cycleTimeNs parameter mismatch in C_Demo #50

Closed MarioVolarevic closed 3 months ago

MarioVolarevic commented 4 months ago

Hello, I noticed an issue, but I'm not sure which part is actually wrong, so I'm reporting it here.

Based on this diff I see that you modifed what is requested in the XcpCreateEvent method

image

But in C_Demo example, what is actually sent to the function is: gXcpEvent_EcuCyclic = XcpCreateEvent("ecuTask", ECU_TASK_CYCLE_TIME_US/CLOCK_TICKS_PER_US, 0, 0, 0); which is actually value in ms and this incorrectly creates the unit and channel cycle time in a2l.

Now, the question is if only the demo parameter is incorrectly calculated or functionality for calculating the unit and cycleTime inside XcpCreateEvent also has to be modified?

RainerZ commented 3 months ago

Hello, you are right. The code in the C_Demo example is incorrect. The cycletime value should be in ns. The semantic modification of the cycletime parameter in XcpCreateEvent from us to ns happened in commit 876aca1f 2022-03-02 20:22. The code in ecu.c is wrong since this commit. The cycle time information of an event will only be written to the A2l file. CANape does not need it or check it to create a DAQ setup, unless packed mode is used.

Thanks

Thanks