<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: CAN filter in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183439#M13530</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See attached pictures from datasheet.&amp;nbsp;One picture shows Standard identifier (IDE=0) mapping (which ID bit in which Tx/Rx buffer register/register_bit). Another picture shows the same for Extended identifier (IDE=1, SRR=1).&lt;/P&gt;&lt;P&gt;Acceptance filters, both&amp;nbsp;IDARx and IDMRx&amp;nbsp;have exactly the same ID&amp;nbsp;mappings.&lt;/P&gt;&lt;P&gt;IDMRx bit set to '1' makes corresponding IDRx bit don't care (bit is passed). IDMRx bit set to '0' makes filter passing only if corresponding IDRx bit matches corresponding IDARx bit.&lt;/P&gt;&lt;P&gt;If 8 bit mode, acceptance filters analyse only IDR0 register. In standard mode, thats ID bits ID10 to ID3. In extended - ID28 to ID21. All other ID bits are don't care.&lt;/P&gt;&lt;P&gt;In 16bit mode, IDR0 and IDR1 registers are analysed.&lt;/P&gt;&lt;P&gt;Is it now more clear?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's analyse what's your setup would accept. You didn't setup CANIDMR1 and CANIDMR2. As docs say, by default IDMRx are reset to 0. So CANIDMR0-CANIDMR2 = 0, CANIDMR=0xFF. IDR3 bits are don't care, IDR0-IDR2 bits have to match IDAR0-IDAR1 bits.&lt;/P&gt;&lt;P&gt;CANIDAR1 = 0xFF, so IDE=1 and SRR = 1, so only eExtended identifier messages are accepted.&lt;/P&gt;&lt;P&gt;CANIDAR0= 0x18, so ID25=1, ID24=1.&lt;/P&gt;&lt;P&gt;CANIDAR1=0xFF, so ID20..ID15=1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CANIDMR3 = 0xFF, so all combinations of ID6..ID0 are accepted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So IDs accepted are from (1&amp;lt;&amp;lt;25)|(1&amp;lt;&amp;lt;24)|(0x3F &amp;lt;&amp;lt;15) = 0x31F8000&amp;nbsp;to 0x31F807F, both RTR=1 and RTR=0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try using search at bottom of this page. It should reveal some more answers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 May 2009 22:43:02 GMT</pubDate>
    <dc:creator>kef</dc:creator>
    <dc:date>2009-05-21T22:43:02Z</dc:date>
    <item>
      <title>CAN filter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183438#M13529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I use MC9S08DZ60&amp;nbsp;and I&amp;nbsp;must make a CAN application, but I am not able to do&amp;nbsp;the can filter.&lt;/P&gt;&lt;P&gt;I set the CANIDAC register fo two filter of 32 bit, the CANIDAR0/3 registers with my ID that I want to filter&amp;nbsp;and the CANIDMR0/3 with the mask, how it is written on data sheets, but it does not function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I write the example that I am doing&lt;/P&gt;&lt;P&gt;CANIDAC=0x00&amp;nbsp; obviously written with its procedure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CANIDAR0=0x18&lt;/P&gt;&lt;P&gt;CANIDAR1=0xFF&lt;/P&gt;&lt;P&gt;CANIDAR2=0x00&lt;/P&gt;&lt;P&gt;CANIDAR3=0x00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CANIDMR0=0x00&lt;/P&gt;&lt;P&gt;CANIDMR0=0x00&lt;/P&gt;&lt;P&gt;CANIDMR0=0xff&lt;/P&gt;&lt;P&gt;CANIDMR3=0xff&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;With this mask I want to applicate the filter only at the four initial byte and the other are do not care.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me?&amp;nbsp;Does someone know what I make the mistake?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Bye&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2009 16:35:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183438#M13529</guid>
      <dc:creator>francy</dc:creator>
      <dc:date>2009-05-21T16:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: CAN filter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183439#M13530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See attached pictures from datasheet.&amp;nbsp;One picture shows Standard identifier (IDE=0) mapping (which ID bit in which Tx/Rx buffer register/register_bit). Another picture shows the same for Extended identifier (IDE=1, SRR=1).&lt;/P&gt;&lt;P&gt;Acceptance filters, both&amp;nbsp;IDARx and IDMRx&amp;nbsp;have exactly the same ID&amp;nbsp;mappings.&lt;/P&gt;&lt;P&gt;IDMRx bit set to '1' makes corresponding IDRx bit don't care (bit is passed). IDMRx bit set to '0' makes filter passing only if corresponding IDRx bit matches corresponding IDARx bit.&lt;/P&gt;&lt;P&gt;If 8 bit mode, acceptance filters analyse only IDR0 register. In standard mode, thats ID bits ID10 to ID3. In extended - ID28 to ID21. All other ID bits are don't care.&lt;/P&gt;&lt;P&gt;In 16bit mode, IDR0 and IDR1 registers are analysed.&lt;/P&gt;&lt;P&gt;Is it now more clear?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's analyse what's your setup would accept. You didn't setup CANIDMR1 and CANIDMR2. As docs say, by default IDMRx are reset to 0. So CANIDMR0-CANIDMR2 = 0, CANIDMR=0xFF. IDR3 bits are don't care, IDR0-IDR2 bits have to match IDAR0-IDAR1 bits.&lt;/P&gt;&lt;P&gt;CANIDAR1 = 0xFF, so IDE=1 and SRR = 1, so only eExtended identifier messages are accepted.&lt;/P&gt;&lt;P&gt;CANIDAR0= 0x18, so ID25=1, ID24=1.&lt;/P&gt;&lt;P&gt;CANIDAR1=0xFF, so ID20..ID15=1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CANIDMR3 = 0xFF, so all combinations of ID6..ID0 are accepted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So IDs accepted are from (1&amp;lt;&amp;lt;25)|(1&amp;lt;&amp;lt;24)|(0x3F &amp;lt;&amp;lt;15) = 0x31F8000&amp;nbsp;to 0x31F807F, both RTR=1 and RTR=0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try using search at bottom of this page. It should reveal some more answers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2009 22:43:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183439#M13530</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2009-05-21T22:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: CAN filter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183440#M13531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kef,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have alredy seen that picture on datasheet and&amp;nbsp;I am using the extend identifier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my example I made a mistake of writing; the correct configuration is&lt;/P&gt;&lt;P&gt;CANIDAR0=0x18&lt;/P&gt;&lt;P&gt;CANIDAR1=0xFF&lt;/P&gt;&lt;P&gt;CANIDAR2=0x00&lt;/P&gt;&lt;P&gt;CANIDAR3=0x00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CANIDMR0=0x00&lt;/P&gt;&lt;P&gt;CANIDMR1=0x00&lt;/P&gt;&lt;P&gt;CANIDMR2=0xff&lt;/P&gt;&lt;P&gt;CANIDMR3=0xff&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not understood:&lt;/P&gt;&lt;P&gt;"So IDs accepted are from (1&amp;lt;&amp;lt;25)|(1&amp;lt;&amp;lt;24)|(0x3F &amp;lt;&amp;lt;15) = 0x31F8000&amp;nbsp;to 0x31F807F, both RTR=1 and RTR=0"&lt;/P&gt;&lt;P&gt;I want that IDs accepted are from 0x18ff0000 to 0x18ffffff. How can I do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also used another configuration&lt;/P&gt;&lt;P&gt;CANIDAR0=0x18&lt;/P&gt;&lt;P&gt;CANIDAR1=0xFF&lt;/P&gt;&lt;P&gt;CANIDAR2=0xC0&lt;/P&gt;&lt;P&gt;CANIDAR3=0x00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CANIDMR0=0x00&lt;/P&gt;&lt;P&gt;CANIDMR1=0x00&lt;/P&gt;&lt;P&gt;CANIDMR2=0x3f&lt;/P&gt;&lt;P&gt;CANIDMR3=0xff&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;so from id20 to id13 are 1 and srr and ide are also 1,but the result don not change.&lt;/P&gt;&lt;P&gt;I&amp;nbsp;am not able&amp;nbsp;that IDs accepted are from 0x18ff0000 to 0x18ffffff&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 May 2009 14:28:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183440#M13531</guid>
      <dc:creator>francy</dc:creator>
      <dc:date>2009-05-22T14:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: CAN filter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183441#M13532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;francy wrote:&lt;BR /&gt;&lt;P&gt;CANIDAR0=0x18&lt;/P&gt;&lt;P&gt;CANIDAR1=0xFF&lt;/P&gt;&lt;P&gt;CANIDAR2=0x00&lt;/P&gt;&lt;P&gt;CANIDAR3=0x00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not understood:&lt;/P&gt;&lt;P&gt;"So IDs accepted are from (1&amp;lt;&amp;lt;25)|(1&amp;lt;&amp;lt;24)|(0x3F &amp;lt;&amp;lt;15) = 0x31F8000&amp;nbsp;to 0x31F807F, both RTR=1 and RTR=0"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Bit4 from CANIDAR0 is ID25 (bit25 of extended CAN identifier), that's 2^25 or 1&amp;lt;&amp;lt;25&lt;/P&gt;&lt;P&gt;Bit3 from CANIDAR0 is ID24, 1&amp;lt;&amp;lt;24&lt;/P&gt;&lt;P&gt;All CANIDAR1 bits are set, that's 6 conseutive bits from ID20 to ID15. Binary consisting of 6 ones equals 2^6 -1 = 0x3F. Least of these bits is bit15 of CAN identifier, so we need to shift 0x3F left by 15 bit positions,&amp;nbsp;0x3F &amp;lt;&amp;lt; 15.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You want to accept 0x18FF0000 to 0x18FFFFFF. 0x18FF0000 identifier has ones from bit16(ID16) to bit28(ID28) (not as you said id20 to id13). Now look again at extended id mapping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CANIDAR0 = 0xFF; // ID28..ID21 are set&lt;/P&gt;&lt;P&gt;CANIDAR1 = 0xE6 | 0x18; // ID20..ID16 are set, plus IDE and SRR are set&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since all other bits (and probably RTR, you didn't say) are don't care, you don't have to set up CANIDAR2 and CANIDAR3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now masks.&lt;/P&gt;&lt;P&gt;CANIDMR0 = 0; // received ID28..ID21 have to match what's specified in IDAR0&lt;/P&gt;&lt;P&gt;CANIDMR1 = 1; // received ID20..ID16 (but not ID15), IDE, SRR have to match what's specified in IDAR1&lt;/P&gt;&lt;P&gt;CANIDMR2 = 0xFF; // ID14..ID7 are don't care&lt;/P&gt;&lt;P&gt;CANIDMR3 = 0xFF; // ID6..ID0 and RTR are don't care&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 May 2009 22:57:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183441#M13532</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2009-05-22T22:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: CAN filter</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183442#M13533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks kef&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 May 2009 13:21:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/CAN-filter/m-p/183442#M13533</guid>
      <dc:creator>francy</dc:creator>
      <dc:date>2009-05-25T13:21:10Z</dc:date>
    </item>
  </channel>
</rss>

