NI CAN Transmitting Duplicate Frames

Updated Jul 23, 2018

Reported In

Hardware

  • PXI-8462

Driver

  • NI-CAN

Issue Details

I am using the NI CAN driver and when I transmit data at fast rates (ms) I am seeing duplicate data being transmitted. Why is this happening? 

Solution

This is expected behavior. When the queue size is set to zero, the first write will immediately start to transfer the data to the firmware. Subsequent writes will then be ignored if they happen too quickly or before the frame has a chance to complete transmission. 

The proper way to architect an application to avoid this problem is to use a queue size of 1. The single element in the queue will still begin to transmit instantly, however, there is also an error generated if the queue is full. The user can then check to see if this frame will transmit instantly or not and take the appropriate action.

Additional Information

Some workarounds include: 
1. Increase the loop period to make less calls to the driver
2. Instead of timing, use WaitForState function with Write Success state, you can increase the sending Rate with this method
3. Use ncWriteMult instead of ncWrite and send packets(arrays) of frames with WaitForState option.

WAS THIS ARTICLE HELPFUL?

Not Helpful