Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN reception for a specific message

Hi All
 
I want to receive a specific message from the CAN network. Suppose there are different message and i need to filter only one particular message. Could anyone pls help me in this regard ? If possible give some sample code also
 
Regards
Anoop
0 Kudos
Message 1 of 6
(5,165 Views)

Straight question, straight answer: Yes there are examples for how to read a single frame. See the attached examples for standart (STD) ID and extended (XTD) ID.

DirkW

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

Thanks for your reply...

Why did you put a while loop in the reception side. Is that for continuous reception ? But assume that message which i want to receive is a response to another message which i have already sent. In that case, should i go for a while loop ? I am using CAN series 2. I read somewhere that series 2 may not support filtering properly. Please clarify these doubts

Thanks in advance

Anoop

0 Kudos
Message 3 of 6
(5,153 Views)
The while loop is in place, because i wanted to create a application which receives continuously. But you could remove the loop and the read would be executed a single time.
The Series 2 brings a new CAN controller, the SJA 1000. This controller uses his own filter mechanism, which is implemented in the examples. The older Series 1 boards used the configuration attributes for comperator and mask to enable the filter and this mechanism is usable with Series 2 as well because of backwards compatibility reasons. But with Series 2 it is implemented in software (firmware). Thus if you use the old filter configuration, you may experience a performance impact. That's probably the rumor you had in mind? Well as long as you use the series 2 filter modes for your series 2 board, there is nothing you have to worry about.
 
DirkW
0 Kudos
Message 4 of 6
(5,139 Views)

Thanks again .. But still some doubts remain

This is a paragraph from the Ni CAN software/hardware manual

" The Philips SJA1000 does not support distinct standard and extended masking. Therefore, on Series 2 interfaces the StandardMask/Comparator and Extended Mask/Comparator attributes are implemented in software (for backward compatibility). Since software masking can have an adverse impact on receive performance, National Instruments recommends that you disable software masking for Series 2 interfaces. Disable software masking by specifying don’t-care (0) for all four mask/comparator attributes of ncConfigCANNet.vi."           Here they said to disable the masking for series 2 interfaces. I am not able to co relate what you said and th one mentioed above. Please clarify me. Also its mentioned that to apply 0 to diasble all comparator/masing functionalities. But in the code which you have provided , 0 have been applied to all comparator/Masking attributes of ncConfigCANNet.vi but you have used the comparator/masking functionalities. How will that work. Please clarify this as well

Thanks in advance

Anoop

 

0 Kudos
Message 5 of 6
(5,131 Views)
Perhaps i was not clear anough. There are two different filter mechanism in place with Series 2 boards right now. We still have the old way to program a filter using the configuration cluster comperator and mask attributes. This is the mechanism implemented in hardware for the Series 1 Intel controller . The Series 2 because it uses a different controller has not the same filter build in hardware available. Because we had to be compatible with Series 1, we implemented this configuration cluster filter in software. And if you have to use older code which uses these filter attributes  but with Series 2, you may experience a perrformance impact.
But the Series 2 has his own  filter mechanism, which is used with the examples i posted. And there is no performance impact with this solution.
 
Hope that helps
 
DirkW
 
 
0 Kudos
Message 6 of 6
(5,123 Views)