Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Repeated and lost samples with NI-CAN

I am using LabVIEW 2009 SP1 with NI-CAN 2.7 and a series 2 CAN card on a PXI system running LabVIEW RT.

 

I sync'ed my DAQmx AI measurement with a NI-CAN task using the "CAN Sync Start with DAQmx". The Start is now sync'ed.

 

As for the samples, I created a test environment: A microcontroller sends a signal via CAN. The signal contains a value that is incremented by 1 with each new CAN message. My PXI measurement programm samples these CAN signal values alongside with DAQmx (5 KHz sample rate, reading 1000 CAN and DAQmx AI values in a while loop). The plot below shows, that sometimes the current value is not sampled, instead the last value is resampled up to 16 times, i. e. the value does stay the same as the last value where it should increment. I made sure, that the source of this effect is not the microcontroller using a third party CAN logging tool.

 

ni-can-bild.png

 

The picture below shows the CAN init procedure:

 

initcan.png

 

Does anyone know why I get these repeated CAN signal values?

 

0 Kudos
Message 1 of 5
(6,496 Views)

Addition: I attached a little program that follows the tutorial Synchronizing CAN and Analog Signals for Device Validation. A CAN device that is simply sending CAN messages with a strongly incremented signal at a rate approx. 4000 Hz is connected to the series 2 PXI card.

 

This program will sometimes resample the same value for 2 times (i. e. the value occurred 3 times in a sequence). This should not happen at a sample rate of 5000 Hz vs. 4000 Hz for incoming CAN messages.

 

If I remove the whole DAQmx sync part, the CAN sampling will be fine, i. e. the sampling will never resample a value more than once -- exactly as expected.

 

Is the attached CAN sync program done wrong or is there a technical limit somewhere?

 

0 Kudos
Message 2 of 5
(6,456 Views)

What Kind of Hardware are you use (PXI-Chassi,-Controller,-Cards)

and witch Software Version (LabVIEW, LabVIEW RT) and Driver Version (DAQmx and CAN Drivers)

are installed?

 

 

0 Kudos
Message 3 of 5
(6,434 Views)

system: PXI-1042, PXI-8108

 

software: LabVIEW 2009 SP1, NI-CAN 2.7.2, DAQmx 9.2.2, LabVIEW Real-Time 9.0.1

 

cards: PXI-6255, PXI-8464/2 Series 2

 

PS: I will post a data file with the measured CAN signals (including interface timestamps) later this day. I will do the measurement with third party Vector CANalyzer and a CANcaseXL. I did this measurement before to make sure there is no other error source, but I will repeat it today. I will also post the array with the repeated signal values.

0 Kudos
Message 4 of 5
(6,427 Views)

I ran a new measurement for approx. 2 minutes and got 2 independent measurement data files:

 

  • the attached VI from above was slightly changed, so that the check loop now saves all received CAN data to a file
  • I started Vector CANalyzer on a separate Laptop that is also connected to the CAN wire, but only listening and logging in passive mode (i. e. no ACK is send so that there is no interference with the ongoing communication between PXI and the sending microcontroller)

I attached both measurement files in CSV format. You will see, that the timestamp dt from CANalyzer does not show any message holes. As for the PXI, I see ~5x repeating values.

 

 

Note: The CANalyzer timestamps are given in 10 us units. The PXI data just contains the incremented signal without timestamps.

 

0 Kudos
Message 5 of 5
(6,418 Views)