From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN queue overflow/Error BFF6211A

Hello All,

              I'm working with an application that needs to log the messages of the CAN bus.I'm using the Channel_Monitor.vi that came with the NI examples and made changes to suit my application.I get this Error message of CAN Queue overflow when I'm running the test.

 

I'm logging one message after another. I get the error when Its logging  the 2nd or 3rd message.I understand it is because the receive queue is filled up and I need to read data quicker.I read other messages in the forum and I tried the following

 

1) Introduced a 1ms delay in the CAN_read single chan Multi samp 1d Time Dbl.vi.(Was trying to slow the read process,I dono if this is right way ?)

 

2) Increased the queue lenght to 150 in NI-CAN\nicanopt.ini [internal channel queue].(is there any other way to check the internal queue is set to 150 ?]

 

I had to change the number of samples to read in the CAN_Read to 1(In the NI example,instead of 1000) to capture the correct values and avoid duplicates.

 

I'm attaching the NI_spy file showing the error.

 

any help would be appreciated.

 

Thanks

-Vamshi

 

 

 

 

 

0 Kudos
Message 1 of 15
(7,916 Views)

The queue overflow you see is actualy the host queue. The driver copies all the frames to a large host queue. That happens in the backround. if you do not call the read frequently enough or read a single frame only the overflow happens sooner or later, because the frames ramp up in the backround queue.

The nicanopt.ini file is configuring the shared memory queue between board and host. since the driver is taking care of emptying this queue on time, you should not change the configuration within this file.

See the attached example, that reads A single channel with a ms delay and up to 100 values at a time. The task type is timestamped input. This type reads new values only. Thus it acts pretty much like the frame api read mult function and ignores the sample rate since it doesn't sample.

 

DirkW

0 Kudos
Message 2 of 15
(7,900 Views)

Hey Dirk,

              I'm almost done working with the Channel_monitor.vi so I'm looking for a way to clear the CAN Queue overflow error.Right now I'm stopping the VI once i see the Overflow error as a result I log only say 3-4 minutes worth of data compared to the required 10 minutes.

              I see if I re-run the Vi after the Error.It works fine.So I'm thinking if there is way to clear the queue on-the-go ? or increase the queue lenght ? . I find the queue overflows only for 10ms and 20ms messages but works fine for a 100ms-1000ms messages.

               I'm kinda stuck with the queue overflow issue.

 

Thanks

-Vamshi

0 Kudos
Message 3 of 15
(7,887 Views)

Hi,

I do not really understand, why this error still happens. It seems that reading only a single value to slow, fills the queue and causes the overflow.

Could you post your code, so I could have a look to it? And could you check how many different IDs are actualy transmitted on your CAN bus.

 

DirkW

0 Kudos
Message 4 of 15
(7,863 Views)

Hey Dirk,

             Here is the code.you can find it is similar to the NI channel Monitor.vi except that I'm reading the required information into an excel sheet.The write to excel is modified to write strings.You can find I changed the Loop time to 10ms(instead of 1000ms) and the number of samples to read to 1(instead of an 100,that is default with the example).I clearly dont understand what the number of samples to read does but when I set it to 1 it was reading every sample, but when it is at 100 I was missing some data(I can say this after looking at the excel sheet logged with the data).

               you can simulate the error I see when you are trying to read a 10ms signal from the bus over a period of 10mins.The bus usually has 10-15 messages with cyclic times from 10ms to 1000ms.

Download All
0 Kudos
Message 5 of 15
(7,853 Views)

I had a look to your code and it seems the Monitor main loop takes between 20 and 30 ms for one execution. Thats because there is a lot of code in this loop.

I modified the file I/o operation a little bit to improve the performance.

But if your frames arrive faster then 30 Hz, the memory will add up and finaly overflow.

The only thing you can try is to simplify the main loop code. (remove clear and delete).

 

DirkW

0 Kudos
Message 6 of 15
(7,822 Views)

Hey Dirk,

             Thanks for your help.I tried removing the Clear Stats and delete.Vi's but the loop timing is still around 30-40ms.I'm not sure what can be done next? Can we clear the Queue on-the go or something ? or increase the queue lenght ?

 

Thanks again 🙂

 

Vamshi

0 Kudos
Message 7 of 15
(7,819 Views)

Hi,

 

The only chance is to read more then one frame at a time. See the attached VI for how to modify the VI to read multiple frames. The logging part logs all messages per channel and the most recent timestamp. You can modify this example to log every single timestamp as well.

And I modified one of the sub Vis to log ms instead of the date.

 

DirkW

0 Kudos
Message 8 of 15
(7,816 Views)

Hey Dirk,

                  I get a version incompatable error.I'm using version 8.0 and the vi's are in 8.2.1 what can be done?

0 Kudos
Message 9 of 15
(7,808 Views)

The best would be upgrading to LV 8.6. 😉 Meanwhile here is the 8.0 version.

 

DirkW

0 Kudos
Message 10 of 15
(7,802 Views)