Archived:Error -1074388984 Queue Overflow While Using NI-CAN?

Updated Feb 2, 2018

National Instruments does not actively maintain this document.

This content provides support for older products and technology, so you may notice outdated links or obsolete information about operating systems or other relevant products.

Reported In

Other

CAN

Issue Details

I have an NI-CAN application and I received the following error: 
Error -1074388984 occurred at an unidentified location
Possible reason(s):
NI-CAN: (HEX 0xBFF62008) Write queue overflow. Solutions for CAN Object: Increase the length of the write queue; Wait for Write Success state prior to calling Write; To transmit recent data only, set the write queue length to zero. Solutions for Net Interface: Wait for the Write Mult state then repeat Write; Get Number of Entries Free attribute and Write that number of frames


Solution

The problem occurs because the software program is not removing frames from the queue. When you define a queue length in NI-CAN, you are specifying the maximum number of frames that can be in the queue at any one time. The queue may have fewer items if the items are removed from the queue faster than they are added. If the software does not remove items from the queue at the same rate or faster than the device puts them in the queue, then an overflow error is returned.

NI-CAN uses read and write queues to buffer information. When a device writes a message to the bus, the message is stored in the read queue for NI-CAN to retrieve. When the software executes a read operation, it reads information from this queue. Thus, the device might be placing information into the read queue at the same time the application is extracting information from it.  

A similar situation occurs with the write queue. Whenever you execute a write operation from NI-CAN, the board tries to put the message on the bus. With NI-CAN, only one message can be on the bus at any given time. The message with the lowest arbitration ID has the highest priority. The other messages are stored in the write queue until they have the lowest arbitration ID and gain control of the bus. 

A queue overflow error indicates that you have exceeded the size limit(s) of the read and/or write queue. The queues are by default allocated to 150 bytes if you are using Network Objects, or 170 bytes if you are using CAN objects. For more information on the queue length, see How Large Can I Make the Read and Write Queues for NI-CAN? In a software application, queue size is declared in terms of frames.

An example of two situations where queue overflow can occur are given below : 

For the first situation, consider a case where you set your read queue length to 10 frames. If the device puts 1 frame into the queue at a time, but the software does not remove any items from the queue, then you will get a queue overflow error when the device tries to put the 11th frame in the queue. 

In a second situation, consider a case where you set your read queue length to 20 frames. Assume that each frame is 10 bytes, and that you are using Network Objects. Also, assume that the write queue is empty so there are 150 bytes available in the read queue. If the device puts 15 frames in the queue, then when the device adds a 16th frame you will generate an overflow error. Even though the frame is still within the defined limit, the queue has been allocated 150 bytes and the 16th frame will exceed this limit, so a queue overflow error will occur.

These errors can be handled by optimizing the speed at which you are writing to and reading from your CAN card. For further information on optimizing CAN I/O speed, see How Can I Optimize My CAN Bus for Maximum Data Transfer?

WAS THIS ARTICLE HELPFUL?

Not Helpful