Capturing transmitted message from PCAN-View

This forum covers third party software that is for example developed with our APIs
petey293
Posts: 1
Joined: Tue 26. Jan 2021, 08:08

Capturing transmitted message from PCAN-View

Post by petey293 » Tue 26. Jan 2021, 08:28

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!

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Capturing transmitted message from PCAN-View

Post by M.Heidemann » Wed 27. Jan 2021, 11:32

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
---
Marvin Heidemann
PEAK-Support Team

shrutip2
Posts: 6
Joined: Sat 13. Feb 2021, 23:38

Re: Capturing transmitted message from PCAN-View

Post by shrutip2 » Sun 14. Feb 2021, 00:51

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?

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Capturing transmitted message from PCAN-View

Post by M.Heidemann » Mon 15. Feb 2021, 07:21

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
---
Marvin Heidemann
PEAK-Support Team

shrutip2
Posts: 6
Joined: Sat 13. Feb 2021, 23:38

Re: Capturing transmitted message from PCAN-View

Post by shrutip2 » Mon 15. Feb 2021, 15:33

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?
Attachments
D1BCA991-739F-4E8D-AE8B-5F2C038620B6.jpeg
D1BCA991-739F-4E8D-AE8B-5F2C038620B6.jpeg (2.36 MiB) Viewed 11168 times

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Capturing transmitted message from PCAN-View

Post by M.Heidemann » Mon 15. Feb 2021, 15:51

Hello,

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

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

shrutip2
Posts: 6
Joined: Sat 13. Feb 2021, 23:38

Re: Capturing transmitted message from PCAN-View

Post by shrutip2 » Mon 15. Feb 2021, 16:17

It’s the error code returned from CAN_SetValue function.
The error value is 65536 which signifies ‘PCAN_ERROR_UNKNOWN - Unknown error’.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Capturing transmitted message from PCAN-View

Post by M.Heidemann » Mon 15. Feb 2021, 17:05

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
---
Marvin Heidemann
PEAK-Support Team

shrutip2
Posts: 6
Joined: Sat 13. Feb 2021, 23:38

Re: Capturing transmitted message from PCAN-View

Post by shrutip2 » Mon 15. Feb 2021, 17:27

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.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Capturing transmitted message from PCAN-View

Post by M.Heidemann » Tue 16. Feb 2021, 09:09

Do you use your own VI or
do you use a third party VI?

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

Post Reply