<?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>S12 / MagniV MicrocontrollersのトピックID filtering on MSCAN (68HC12)</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/ID-filtering-on-MSCAN-68HC12/m-p/163769#M5249</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some doubts regarding the functionality of the MSCAN filter.&lt;/P&gt;&lt;P&gt;I have read the application note &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fmicrocontrollers%2Fdoc%2Fapp_note%2FAN3034.pdf" rel="nofollow" target="_blank"&gt;AN3034&lt;/A&gt; but i cannot understand some things.&lt;/P&gt;&lt;P&gt;For example, into the application notes it wants to filter the ID 0x100, so why in the first line of code the constant ACC_CODE_ID100 is set to 0x2000 ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;/* Acceptance Code Definitions */&lt;/STRONG&gt;&lt;BR /&gt;#define ACC_CODE_ID100 0x2000&lt;BR /&gt;#define ACC_CODE_ID100_HIGH ((ACC_CODE_ID100&amp;amp;0xFF00)&amp;gt;&amp;gt;8)&lt;BR /&gt;#define ACC_CODE_ID100_LOW (ACC_CODE_ID100&amp;amp;0x00FF)&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;/* Mask Code Definitions */&lt;/STRONG&gt;&lt;BR /&gt;#define MASK_CODE_ST_ID 0x0007&lt;BR /&gt;#define MASK_CODE_ST_ID_HIGH ((MASK_CODE_ST_ID&amp;amp;0xFF00)&amp;gt;&amp;gt;8)&lt;BR /&gt;#define MASK_CODE_ST_ID_LOW (MASK_CODE_ST_ID&amp;amp;0xFF)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/* Acceptance Filters&lt;/STRONG&gt;&lt;BR /&gt;CAN0IDAC = 0x10;&lt;BR /&gt;CAN0IDAR0 = ACC_CODE_ID100_HIGH;&lt;BR /&gt;CAN0IDMR0 = MASK_CODE_ST_ID_HIGH;&lt;BR /&gt;CAN0IDAR1 = ACC_CODE_ID100_LOW;&lt;BR /&gt;CAN0IDMR1 = MASK_CODE_ST_ID_LOW;&lt;BR /&gt;CAN0IDAC = 0x10; // Set four 16-bit Filters&lt;BR /&gt;CAN0IDAR2 = 0x00; // 16-bit Filter 1&lt;BR /&gt;CAN0IDMR2 = MASK_CODE_ST_ID_HIGH; // Accepts Standard Data Frame Msg&lt;BR /&gt;CAN0IDAR3 = 0x00; // with ID 0x100&lt;BR /&gt;CAN0IDMR3 = MASK_CODE_ST_ID_LOW;&lt;BR /&gt;CAN0IDAR4 = 0x00; // 16-bit Filter 2&lt;BR /&gt;CAN0IDMR4 = MASK_CODE_ST_ID_HIGH; // Accepts Standard Data Frame Msg&lt;BR /&gt;CAN0IDAR5 = 0x00; // with ID 0x100&lt;BR /&gt;CAN0IDMR5 = MASK_CODE_ST_ID_LOW; //&lt;BR /&gt;CAN0IDAR6 = 0x00; // 16-bit Filter 3&lt;BR /&gt;CAN0IDMR6 = MASK_CODE_ST_ID_HIGH; // Accepts Standard Data Frame Msg&lt;BR /&gt;CAN0IDAR7 = 0x00; // with ID 0x100&lt;BR /&gt;CAN0IDMR7 = MASK_CODE_ST_ID_LOW; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another question: it's possibile to set a range od IDs to filter? For example i want to see only the messages between IDs 0x01E4 and 0x02E4.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Sep 2011 19:11:24 GMT</pubDate>
    <dc:creator>biccius</dc:creator>
    <dc:date>2011-09-01T19:11:24Z</dc:date>
    <item>
      <title>ID filtering on MSCAN (68HC12)</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/ID-filtering-on-MSCAN-68HC12/m-p/163769#M5249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some doubts regarding the functionality of the MSCAN filter.&lt;/P&gt;&lt;P&gt;I have read the application note &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fmicrocontrollers%2Fdoc%2Fapp_note%2FAN3034.pdf" rel="nofollow" target="_blank"&gt;AN3034&lt;/A&gt; but i cannot understand some things.&lt;/P&gt;&lt;P&gt;For example, into the application notes it wants to filter the ID 0x100, so why in the first line of code the constant ACC_CODE_ID100 is set to 0x2000 ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;/* Acceptance Code Definitions */&lt;/STRONG&gt;&lt;BR /&gt;#define ACC_CODE_ID100 0x2000&lt;BR /&gt;#define ACC_CODE_ID100_HIGH ((ACC_CODE_ID100&amp;amp;0xFF00)&amp;gt;&amp;gt;8)&lt;BR /&gt;#define ACC_CODE_ID100_LOW (ACC_CODE_ID100&amp;amp;0x00FF)&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;/* Mask Code Definitions */&lt;/STRONG&gt;&lt;BR /&gt;#define MASK_CODE_ST_ID 0x0007&lt;BR /&gt;#define MASK_CODE_ST_ID_HIGH ((MASK_CODE_ST_ID&amp;amp;0xFF00)&amp;gt;&amp;gt;8)&lt;BR /&gt;#define MASK_CODE_ST_ID_LOW (MASK_CODE_ST_ID&amp;amp;0xFF)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/* Acceptance Filters&lt;/STRONG&gt;&lt;BR /&gt;CAN0IDAC = 0x10;&lt;BR /&gt;CAN0IDAR0 = ACC_CODE_ID100_HIGH;&lt;BR /&gt;CAN0IDMR0 = MASK_CODE_ST_ID_HIGH;&lt;BR /&gt;CAN0IDAR1 = ACC_CODE_ID100_LOW;&lt;BR /&gt;CAN0IDMR1 = MASK_CODE_ST_ID_LOW;&lt;BR /&gt;CAN0IDAC = 0x10; // Set four 16-bit Filters&lt;BR /&gt;CAN0IDAR2 = 0x00; // 16-bit Filter 1&lt;BR /&gt;CAN0IDMR2 = MASK_CODE_ST_ID_HIGH; // Accepts Standard Data Frame Msg&lt;BR /&gt;CAN0IDAR3 = 0x00; // with ID 0x100&lt;BR /&gt;CAN0IDMR3 = MASK_CODE_ST_ID_LOW;&lt;BR /&gt;CAN0IDAR4 = 0x00; // 16-bit Filter 2&lt;BR /&gt;CAN0IDMR4 = MASK_CODE_ST_ID_HIGH; // Accepts Standard Data Frame Msg&lt;BR /&gt;CAN0IDAR5 = 0x00; // with ID 0x100&lt;BR /&gt;CAN0IDMR5 = MASK_CODE_ST_ID_LOW; //&lt;BR /&gt;CAN0IDAR6 = 0x00; // 16-bit Filter 3&lt;BR /&gt;CAN0IDMR6 = MASK_CODE_ST_ID_HIGH; // Accepts Standard Data Frame Msg&lt;BR /&gt;CAN0IDAR7 = 0x00; // with ID 0x100&lt;BR /&gt;CAN0IDMR7 = MASK_CODE_ST_ID_LOW; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another question: it's possibile to set a range od IDs to filter? For example i want to see only the messages between IDs 0x01E4 and 0x02E4.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 19:11:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/ID-filtering-on-MSCAN-68HC12/m-p/163769#M5249</guid>
      <dc:creator>biccius</dc:creator>
      <dc:date>2011-09-01T19:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: ID filtering on MSCAN (68HC12)</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/ID-filtering-on-MSCAN-68HC12/m-p/163770#M5250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI&gt;For example, into the application notes it wants to filter the ID 0x100, so why in the&lt;/LI&gt;&lt;LI&gt;first line of code the constant ACC_CODE_ID100 is set to 0x2000 ?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;You need to find two figures in your datasheet. One is called like&amp;nbsp;Standard Identifier Mapping (for 11bit ID messagees) and another one like&amp;nbsp;Extended Identifier Mapping (for 29bit ID messages). As you may see in Standard ID mepping, bit0 of ID, ID0 is placed not in bit0 of IDR1 register, but in bit5 of IDR1. Identifier mapping is the same for receuve buffer (CANxRIDRx registers), trasmin buffers (CANxTIDRx registers), and also the same for filter acceptance and mask registers. In the case of standard identifiers, ACC_CODE_ID100 is (0x100&amp;lt;&amp;lt;5)=0x2000. For extended 29bit identifiers it is more complicated. As you may see in AN code, ACC_CODE_ID100 is sperated into high and low part and directly applied to IDAR and IDAM registers, whithout any shifting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Another question: it's possibile to set a range od IDs to filter? For example i want to see only&lt;/LI&gt;&lt;LI&gt;the messages between *IDs 0x01E4 and 0x02E4.&lt;/LI&gt;&lt;/UL&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-24 lia-quilt-column-single lia-quilt-column-footer"&gt;&lt;DIV class="lia-message-footer lia-component-message-footer"&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-04 lia-quilt-column-left"&gt;&lt;DIV class="lia-message-notify"&gt;No, you can't set up filter for ID's from x to y. There are binary masks and binary patters. You use IDAR register to set bit pattern to compare and use IDAM to specify what bits to exclude from comparison. For example you want to pass binary 1100 and 1101. Least bit can be any, all other should match, so you write 0001 to IDAM and either 1100 or 1101 to IDAR. Only 1100 and 1101 will pass through the filter.&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;In your case only top bit is fixed, all other bits can have any values:&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;00111100100&amp;nbsp; -0x1E4&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;&lt;DIV class="lia-message-notify"&gt;00111100101 - 0x1E5&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;&lt;DIV class="lia-message-notify"&gt;00111100110&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;&lt;DIV class="lia-message-notify"&gt;00111100111&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;..&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;&lt;DIV class="lia-message-notify"&gt;01011100011 - 0x2E3&lt;/DIV&gt;01011100100 - 0x2E4&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;You may set up filter to pass messages from 0x0 to 0x03FF and filter out messages with MSB set, 0x400 to 0x7FF, the rest of filtering can be done by software&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;0x0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;&amp;nbsp;IDAC&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;01111111111 - IDAM&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="lia-message-notify"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 20:52:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/ID-filtering-on-MSCAN-68HC12/m-p/163770#M5250</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2011-09-01T20:52:30Z</dc:date>
    </item>
  </channel>
</rss>

