Synchronization of PCAN RCV data

The free CAN Software API (Application Programming Interface) for Windows®
Post Reply
mmagn
Posts: 9
Joined: Fri 13. Mar 2015, 11:30

Synchronization of PCAN RCV data

Post by mmagn » Tue 23. Jun 2015, 14:23

Hello,
I have modified the RCV data in the Example of PCanBasic, but I am having some issues in recording signals.
The goal of my application is monitoring two sensors in parallel and for each the sensor I monitor two signals.

First of all I discriminate TX and RX signal coming from CAN. After the CAN read I have added a for loop and a case structure dependent on the CAN ID.
Then I treat the RX data: in the first case structure I discriminate the sensor ID and in the second case structure I discriminate the signals ID.
Then I treat each signal to get the desired value and using a queue system I put all the signals in a second loop and I save them in a txt file.

The interface works well for a short records: 1 hour or 2 but I record for a night it loose data in a random way. Has anyone have already seen it. Do you have an idea about the cause?

Thanks in advance for some suggestions,
Best regards

K.Wagner
Software Development
Software Development
Posts: 1082
Joined: Wed 22. Sep 2010, 13:36

Re: Synchronization of PCAN RCV data

Post by K.Wagner » Tue 23. Jun 2015, 16:48

Hello,

neither the PCAN-USB nor the API cause losing messages. Our test, and those from many customers work overnight wihtout problems. Please check your code, i.e. check the logic of your read procedure. Take into account that:
  • If the amount of data being received is huge, then you can get queue-overruns, if you don't read the queue fast enough.
  • If you are writing out to a file each time you read the queue, you may have a high CPU load and can be losing processing time, so your queue can get full and, consequently lose messages.
  • If the computer goes in standby (hibernation), then the communication will stop too, i.e. message were not received anymore until the system wakes up.
There is an issue related to USB 3.0 firmware that can cause some problems when the firmware is not up to date. More info at this post: http://www.peak-system.com/forum/viewto ... ?f=7&t=191
Best regards,
Keneth

mmagn
Posts: 9
Joined: Fri 13. Mar 2015, 11:30

Re: Synchronization of PCAN RCV data

Post by mmagn » Tue 7. Jul 2015, 09:26

Hello,
Sorry for the delay I am replying but I was out of office.

Thanks for the suggestions: I will check the different points you have highlighted. In the meantime I will attach the pdf of my interface.

The goal of my application is to manitor, as I wrote in my first thread, 2 sensors in parallel and acquire two signals for each sensor every 5 seconds.
After a while I have launched the measurements, randomly I start loosing signals and I can check this event comparing the Labview and the PCAN records.

So, I was wondering if my problem is at the beginning of the treatment of the data in the for loop used to separate TX and RX commands.
Loop for.JPG
Loop for.JPG (139.44 KiB) Viewed 13798 times
Or in the way to readout the values from the main loop. In general, the queue system should be the best solution to avoid the lost of signals.
queue system.JPG
queue system.JPG (380.51 KiB) Viewed 13798 times
In your opinion, could I try to change something to get the interface working in the proper way?


Thanks in advance.
Berst regards,
M
Attachments
RCV data.pdf
(1.55 MiB) Downloaded 577 times

K.Wagner
Software Development
Software Development
Posts: 1082
Joined: Wed 22. Sep 2010, 13:36

Re: Synchronization of PCAN RCV data

Post by K.Wagner » Tue 7. Jul 2015, 09:59

Hello,

are you using the PCAN-Basic Labview library from PEAK-System? or did you write your own?
Best regards,
Keneth

mmagn
Posts: 9
Joined: Fri 13. Mar 2015, 11:30

Re: Synchronization of PCAN RCV data

Post by mmagn » Tue 7. Jul 2015, 10:28

Hello,

I am using the PCAN-Basic library from PCAN system: I have taken the RCV example and I have modified it to my purposes.
I have simply added a part after the CAN read while loop.

K.Wagner
Software Development
Software Development
Posts: 1082
Joined: Wed 22. Sep 2010, 13:36

Re: Synchronization of PCAN RCV data

Post by K.Wagner » Tue 7. Jul 2015, 11:00

Which programming language are you using? I have assumed Labview because of your PDF. Ok, please post the code you have modified here so that we can inspect it.
Best regards,
Keneth

mmagn
Posts: 9
Joined: Fri 13. Mar 2015, 11:30

Re: Synchronization of PCAN RCV data

Post by mmagn » Tue 7. Jul 2015, 11:16

I am using Labview.

I have tryed to attach directly the Labview vi, but the extension .vi is not allowed. Because of this I posted in pdf.

K.Wagner
Software Development
Software Development
Posts: 1082
Joined: Wed 22. Sep 2010, 13:36

Re: Synchronization of PCAN RCV data

Post by K.Wagner » Tue 7. Jul 2015, 11:28

Sorry but we cannot give support on Labview for PCAN-Basic. You can consider using the LabView Driver. For questions and further information, please contact Mr. Kunze: labview[at]peak-system.com
Best regards,
Keneth

mmagn
Posts: 9
Joined: Fri 13. Mar 2015, 11:30

Re: Synchronization of PCAN RCV data

Post by mmagn » Tue 7. Jul 2015, 11:35

Hello,

Thank you for the suggestion.

Post Reply