Re: Re: CAN Mask & Filter setting at ---- software level
Steinhoff <[email protected]>
| Newsgroups | gmane.comp.hardware.bus.can |
|---|---|
| Message-ID | <[email protected]> |
Well,
that what the SJA1000 specification is showing by the "aceptance
schemes" with the
logical gates is not correct ... there seems to be a misinterpretation
of the IEC gate symbol "=" :)
The real result must be:
result = NOT( filter XOR id ) OR mask;
Isn't it?
--Armin
Steinhoff wrote:
>
> Dinesh.
>
> the result should be:
>
> result = ( filter XOR id ) OR mask;
>
> Acceptance happens if all bits are set in result.
>
> Regards
>
> --Armin
>
> PS: SJA1000 spec / p. 45
>
> Dinesh Guleria wrote:
>> Got the concept.
>>
>> Now if i want DM to trigger for following types 0x01 & 0x33 :--
>>
>> Type to be accepted :--
>> 0x01; // 0000 0001
>> 0x33; // 0011 0011
>>
>> mask = 0xCD; // 1100 1101 -----> put 0 for
>> diffrent bits ------ & ------ 1 for common bits
>> filter = 0x01; // 0000 0001 ------>put 0 for dont care bits
>> ------ & ------ SAME VALUE for common bits
>>
>> result = ( ( filter ^ a_ ) & mask );
>> if(!result)
>> {
>> //accept
>> }
>>
>>
>> This will Rx 0x001, 0x003, 0x011, 0x013, 0x021, 0x023, 0x031 and
>> 0x033 IDs.
>>
>> Still in terms of CAN Rx workload for the processor, only 6 unwanted
>> IDs out of a possible total 2032 CAN IDs (for 11 bit IDEs) to Rx may
>> be of some reduced workload benefit.
>>
>> We can put further filtering at the next level of software to accept
>> message what we want.
>>
>> BTW, weonly get 2032 and not 2048 11 bit CAN IDs because no IDs are
>> allowed to have all 7 most significant bits set at the same time.
>>
>> Regards,
>> Dinesh
>>
>>
>> On Sat, Dec 1, 2012 at 9:34 PM, Dinesh Guleria <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Hi,
>>
>> I have enable my can controller to receive all messages & trying
>> to filtering messages it at software level.
>> I referred following link by Heikki
>> http://old.nabble.com/Setting-CAN-MASK---ID-registers-td14881913.html
>>
>> Suppose i want to receive only ID_1 & ID_2.
>> But I was not able to get the desired result ID-0x03 is still
>> passing the software filter
>>
>>
>> ID_1 = 0x01; // 0000 0001
>> ID_2 = 0x33; // 0011 0011
>> mask = 0x32; // 0011 0010
>> filter = 0x01; // 0000 0001
>>
>> if ---- messageID_Rx = 0x03
>>
>> ========== CODE ======================
>>
>> result = !( ( filter ^ messageID_Rx ) & mask );
>>
>> if ( result )
>> {
>> // ID accepted
>> }
>>
>>
>> ====================================
>>
>> Can someone on list help me to correct this. Or can suggest me
>> where i am getting wrong ?
>> Any reply will be appreciable.
>>
>> Thanks & Regards,
>>
>> Dinesh
>>
>>
>