Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure the Standard Mask/Comparator to ignore range?

Solved!
Go to solution

Hello all,

I want my NI USB 8473 to read all CAN IDs (std and ext) except standard 0x7D0..0x7DF.

How to configure this? Which values should "Standard Comparator" and "Standard Mask" have?

I have read already this thread: Link

The NI documentation tells: (see attached file)

 

hex        binary:

0x7D0  11111010000

0x7DF  11111011111

 

Could anybody help?

Thank you in advance.

 

-------------------------------------------------------------------
Eugen Wiebe
Bernstein AG
CLAD - Certified LabView Associate Developer
0 Kudos
Message 1 of 8
(5,407 Views)

You can take a look at the Series2 Filter Mode example VI to see how to set a filter for the 8473.

 

Unfortunately the filter is an acceptance filter, indicating which frames to accept, not reject. It is pretty easy to accept all values above 0x7DF or all values below 0x7D0. Trying to filter out that range may also require filtering out a good number of other frames that you may be interested in.

 

This particular filtering mechanism is implemented in software though so there is nothing preventing you from reading everything and implementing your own software filter in code.

Jeff L
National Instruments
0 Kudos
Message 2 of 8
(5,358 Views)

Thanks for the reply,

 

but I still don't understand how to set comparator and mask to accept all but 0x7D0..0x7DF.

 

I have found a useful tool for that: Series2 Filter Mode - Pop up.vi :

 

Series2 Filter Mode - Pop up.vi

 

What should resulting filter be?

 

Thank you

-------------------------------------------------------------------
Eugen Wiebe
Bernstein AG
CLAD - Certified LabView Associate Developer
0 Kudos
Message 3 of 8
(5,351 Views)

Background:

Aufbau SDP

 

We use CAN Messages to communicate with ~ 160 CAN participants (self-made measurement cards with µC and CAN interface).

The cards have an µC with Bootloader. The Bootloader on µC is able to get new Firmware over CAN.

The Bootloader CAN IDs are (standard) 0x7D0..0x7DF.

The standard bus load is ~12% (standard means while measurement and not in bootloader mode).

When sending Bootloader messages over CAN, the bus load increases to ~40%.

In this case (means while sending Bootloader messages over CAN) the running LabView Application on the measurement PC runs into errors:NI-CAN:  (Hex 0xBFF62125) NI-CAN copies received CAN frames from the card to a large kernel-level queue. There is one queue for each interface (port). If your application does not read fast enough to emptythis queue over time, the newest frames are lost. Solutions: Call Read more frequently (such as by reducing user-interfacecode); Avoid running other applications during your test (screen savers, MAX, ...); use Series 2 Filter Mode to filter incoming traffic.

 

So I would like to filter out this Bootloader messages in my NI-USB-8473 CAN Adapter in Hardware so that they will not appear in my LabView application. Is it possible? Which values should standard comperator and standard mask have?

 

Thank you

-------------------------------------------------------------------
Eugen Wiebe
Bernstein AG
CLAD - Certified LabView Associate Developer
0 Kudos
Message 4 of 8
(5,347 Views)

Accepting a contiguous range of values can be done by first checking to see what bits the minimum and maximum value have in common. For this example we will accept 0x7D0 through 0x7DF. Even though your goal is to exclude these values, knowing how to accept them will help you to understand the underlying mechanisms in play.

0x7D0 = 0b11111010000

0x7DF = 0b11111011111

Comm = 0b1111101xxxx

 

The bit in common represent the range of bits we want to accept, 0x7dX. This will be our comparator value and will be used to match the incoming frame IDs.

 

The bit mask is used so that the bits in the comparator we care about are set to '0' and the bits we don't care about are '1'. 

 

Setting both up in the Series2 Filter Mode.vi looks like this:

Filter.PNG

 

We can see that the acceptance logic is quite simple and also somewhat limiting. It isn't possible to accept all numbers below 0x7D0 and all numbers above 0x7DF with this basic logic.

 

How fast are you you reading from the device? Can you separate your reading logic from the slower parts of your application and read from the devices at a faster rate? 

 

Jeff L
National Instruments
0 Kudos
Message 5 of 8
(5,339 Views)

OK, I understand how to accept this messages.

And how to exclude these messages?

 

My start of communication is this:

Start of CAN communication

 

Baudrate: 500k

 

Thanks and BR

EWiebe

-------------------------------------------------------------------
Eugen Wiebe
Bernstein AG
CLAD - Certified LabView Associate Developer
0 Kudos
Message 6 of 8
(5,331 Views)
Solution
Accepted by topic author EWiebe

The filter is an acceptance filter. It allows you to select which frames to accept. 

 

No combination of the comparator and mask will allow you to exclude the desired values without also excluding other IDs that you want to accept. 

 

A better approach will be to address the buffer overflow problem by reading frames more frequently. Even at 1 Mbps and 40% bus load it should be possible to read all the values and simply discard the IDs you don't need.

Jeff L
National Instruments
Message 7 of 8
(5,314 Views)

HI Jeff,

Please, can you share the "Series2 Filter Mode - Pop Up.vi" utility

I'm not able to find it

Thank you in advance

monica

0 Kudos
Message 8 of 8
(3,065 Views)