Page 1 of 2

Capturing transmitted message from PCAN-View

Posted: Tue 26. Jan 2021, 08:28
by petey293
Hello,

A quick question for you guys!

Just wondering if there's a quick and easy way to capture a sent user-generated message from PCAN-View, just the CAN ID and data content. I've done a super quick poke-around in the PCAN-Basic API, would I benefit from looking a little further into it?

Thanks in advance for the help!

Re: Capturing transmitted message from PCAN-View

Posted: Wed 27. Jan 2021, 11:32
by M.Heidemann
Hello,

Thank you for your request.

The easiest way to capture messages is to use the Trace-feature of PCAN-View,
which allows you to capture all messages present on the bus.

Sent messages will be marked as "TX" in the trace-file.

Also you can export all messages currently in your transmit list as a transmit-list file
via the File-dialogue -> "Save".

You could also use the PCANBasic-API for this purpose, if you prefer.

In this case you could write all messages transmit to a seperate file once PCANBasic
returns a successful transmission.

Maybe you could describe your usecase a bit further so i might suggest a more tailored solution to you.

Best Regards

Marvin

Re: Capturing transmitted message from PCAN-View

Posted: Sun 14. Feb 2021, 00:51
by shrutip2
I have created labview vi using pcan basic dll. I am able to read and write the messages but I am not able to capture a trace using pcan basic api.

I have set following parameters using CAN_SetValue function-
1. PCAN_TRACE_LOCATION
2. PCAN_TRACE_STATUS
3. PCAN_TRACE_SIZE
4. PCAN_TRACE_CONFIGURE

are these parameters supposed to be set in some order? Can you provide an example?

Re: Capturing transmitted message from PCAN-View

Posted: Mon 15. Feb 2021, 07:21
by M.Heidemann
Hello,

The Parameter PCAN_TRACE_STATUS is also setable,
to start the the Trace you'll have to set it ("PCANBasic.PCAN_PARAMETER_ON").

Furthermore you`ll have to make sure you are actively reading during the recording of
a trace.

So, after configuration you'll have to set the PCAN_TRACE_STATUS and make sure
PCANBAsic is reading during the recording of a trace.

Code: Select all

 TPCANStatus stsResult;
            uint iStatus = PCANBasic.PCAN_PARAMETER_ON;

            // We activate the tracing by setting the parameter.
            stsResult = PCANBasic.SetValue(PcanHandle, TPCANParameter.PCAN_TRACE_STATUS, ref iStatus, sizeof(int));

            if (stsResult != TPCANStatus.PCAN_ERROR_OK)
            {
                ShowStatus(stsResult);
            }
Please report back to us, if this has solved your issue.

Best Regards

Marvin

Re: Capturing transmitted message from PCAN-View

Posted: Mon 15. Feb 2021, 15:33
by shrutip2
I was not setting the buffer length before.

But now after setting the buffer length I am getting unknown error.

Could you please check the attachment and confirm if the values I am setting are correct or not?

Re: Capturing transmitted message from PCAN-View

Posted: Mon 15. Feb 2021, 15:51
by M.Heidemann
Hello,

Can you share a screenshot of this unknown error with us?

Best Regards

Marvin

Re: Capturing transmitted message from PCAN-View

Posted: Mon 15. Feb 2021, 16:17
by shrutip2
It’s the error code returned from CAN_SetValue function.
The error value is 65536 which signifies ‘PCAN_ERROR_UNKNOWN - Unknown error’.

Re: Capturing transmitted message from PCAN-View

Posted: Mon 15. Feb 2021, 17:05
by M.Heidemann
What exactly did you change regarding the bufferlength?
the bufferlength seems to be defined as a Uint32
as far as i can tell from your screenshot.

The length of the buffer is the size of uint32 or 4Bytes.

Please report back to us regarding this.

Best Regards

Marvin

Re: Capturing transmitted message from PCAN-View

Posted: Mon 15. Feb 2021, 17:27
by shrutip2
Earlier I was not passing any value to buffer length so I am guessing it was taking the default value as 0 and I wasn’t getting any error. But after looking at the example you provided I passed 4 as the value for buffer length and now with buffer length 4 I am getting unknown error.

Re: Capturing transmitted message from PCAN-View

Posted: Tue 16. Feb 2021, 09:09
by M.Heidemann
Do you use your own VI or
do you use a third party VI?

Best Regards

Marvin