Page 2 of 3

Re: Reset timestamps

Posted: Mon 24. Jun 2024, 09:42
by M.Heidemann
Hello,

Yes, Self-Receive / Echo_Messages frames are supported by the firmware.

Best Regards

Marvin

Re: Reset timestamps

Posted: Mon 24. Jun 2024, 11:23
by jorgz
Sorry another question, I am using this example:
https://docs.peak-system.com/API/PCAN-B ... 889cd1.htm
To activate the echo frames, on this function:

Code: Select all

Api.SetValue(channelUsed, PcanParameter.AllowEchoFrames, ParameterValue.Activation.On)
In my case it looks like this:

Code: Select all

PCANBasic.SetValue(PCANHandle, TPCANParameter.PCAN_ALLOW_ECHO_FRAMES, PCANBasic.PCAN_PARAMETER_ON)
The thing is I get an error that the SetValue needs more parameters, when I go to PCANBasic I dont find any setValue funtion that only takes 3 paramters:

Code: Select all

        [DllImport("PCANBasic.dll", EntryPoint = "CAN_SetValue")]
        public static extern TPCANStatus SetValue(
            [MarshalAs(UnmanagedType.U2)]
            TPCANHandle Channel,
            [MarshalAs(UnmanagedType.U1)]
            TPCANParameter Parameter,
            ref UInt32 NumericBuffer,
            UInt32 BufferLength);

[DllImport("PCANBasic.dll", EntryPoint = "CAN_SetValue")]
        public static extern TPCANStatus SetValue(
            [MarshalAs(UnmanagedType.U2)]
            TPCANHandle Channel,
            [MarshalAs(UnmanagedType.U1)]
            TPCANParameter Parameter,
            ref UInt64 NumericBuffer,
            UInt32 BufferLength);

[DllImport("PCANBasic.dll", EntryPoint = "CAN_SetValue")]
        public static extern TPCANStatus SetValue(
            [MarshalAs(UnmanagedType.U2)]
            TPCANHandle Channel,
            [MarshalAs(UnmanagedType.U1)]
            TPCANParameter Parameter,
            [MarshalAs(UnmanagedType.LPStr,SizeParamIndex=3)]
            string StringBuffer,
            UInt32 BufferLength);
Im using the latest version of PCANBasic.cs. So the overload of SetValue is the error, my question is what am I doing wrong?
Thanks

Re: Reset timestamps

Posted: Mon 24. Jun 2024, 11:30
by K.Wagner
Hello,

please do not mix things. The class "Api" is a new (better) class tht is exposed in the PCAN-Basic.NET NuGet packlage. The class "PCANBasic" is a C#-wrapper, which is delivery as a form of a single C#-header file.

If you are using the nuget package and you want to keep using the old class, this is posible, but we do not recommend it, as (like this case), you may get confuse. See for this the following documentation: https://docs.peak-system.com/API/PCAN-B ... f27d64.htm and Can I mix old and new PCAN-Basic code in a project?

Re: Reset timestamps

Posted: Tue 25. Jun 2024, 10:10
by jorgz
Thanks for the reply and clarification. I want to continue using only the c# wrapper, sorry the dumb question: so in my case this would be the way to activate the echo frames right?

Code: Select all

UInt32 iBuffer;
          iBuffer = PCANBasic.PCAN_PARAMETER_ON;
         TPCANStatus ret2 = PCANBasic.SetValue(PCANHandle, TPCANParameter.PCAN_ALLOW_ECHO_FRAMES,ref iBuffer,sizeof(UInt32));

Re: Reset timestamps

Posted: Tue 25. Jun 2024, 11:26
by jorgz
just read the documentation, and to answer my own question, yes its correct: https://www.peak-system.com/fileadmin/m ... -basic.zip
see examples.
Please dont close the thread since Im still working on this. Thanks

Re: Reset timestamps

Posted: Fri 12. Jul 2024, 13:51
by jorgz
Hello,

I was able to read hw timestamps on send on receive messages for a specific testbench. The bench where the timestamps worked has following drivers/api versions:

-firmware 3.2
-Pcan_virtual.svs 4.3.0.16563, Pcan_usb.sys 4.3.0.16563
-PEAKRP32.dll 4.0.1.280, PEAKRP32.dll 4.0.1.280
-CanApi2.ll 2.59.0.151, CanApi4.dll 4.3.4.312, PCANBasic.dll 4.6.0.600, PEAKRP32.dll 4.0.1.280, PLinApi.dll 2.8.1.167

The bench where the timestamps did not work has following drivers/api versions:

On the testbench with newer drivers the timestamp activation is not working and I get PCAN_ERROR_ILLPARAMTYPE when initializing the channel, the hardware is the same PCAN USB6
-firmware 3.2.0
-Pcan_virtual.sys 4.5.0.16741, Pcan_usb.sys 4.5.0.16741, Pcan_lan.sys 4.2.3.16490
-PEAKRP32.dll 4.0.6.345
-CanApi2.ll 2.58.0.143, CanApi4.dll 4.2.1.143, PCANBasic.dll 4.9.0.942

Can the error be due to CanAPI2.dll? I used https://www.peak-system.com/quick/DrvSetup to update the drivers but still I get PCAN_ERROR_ILLPARAMTYPE
thanks

Re: Reset timestamps

Posted: Fri 12. Jul 2024, 15:18
by M.Heidemann
Hello,

Can you please show us your code?

If this is too public, consider sending an email to support[at]peak-system.com

Re: Reset timestamps

Posted: Mon 15. Jul 2024, 09:03
by jorgz
I have sent you an email with the information.

Re: Reset timestamps

Posted: Tue 23. Jul 2024, 14:29
by jorgz
Hello,

I have managed to obtained the timestamps and I have made a long recording of about 7.5-8 hr. After the timestamp reaches a certain point the clock goes back to zero about every 1 hr and 10 minutes:

last time: 4294966953 then time stamp start over again to: 3197
last time:4294923471 then time stamp start over again to: 42107
last time:4294964317 then time stamp start over again to: 8593
last time:4294959680 then time stamp start over again to: 3848
last time:4294883708 then time stamp start over again to: 2208
last time:4294965805 then time stamp start over again to: 5829
last time:4294954446 then time stamp start over again to: 1474

My question is, in order to add up the times, should I add the last greatest time for each cycle like 4294966953 + 3197 and so on and accumulate the time or what is the largest value the clock can reach? in my case the largest one was 4294966953.

Thanks

Re: Reset timestamps

Posted: Tue 23. Jul 2024, 14:34
by M.Heidemann
Hello Jorgz,

That sounds off.

The Timestamp should not just reset like that,
can you show us your trace-routine?

In gerneral yeah, adding these values would be the way to go but the thing is -
you shouldn't have to do that.

Let's see what the cause for this is.

Best Regards

Marvin