<?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>LPC Microcontrollers中的主题 Re: LPC43xx CAN interrupt direction (LPCOpen)</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC43xx-CAN-interrupt-direction-LPCOpen/m-p/671415#M26849</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi quex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; You can refer to the LPCopen sample code, check the ID, because the transfer ID and receive ID is defined by the code, you can know it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Just like the LPCopen CAN0_IRQHandler code.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19716iF1C29E4F0F2B913D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; About the CCAN_STAT_TXOK and CCAN_STAT_RXOK question, you also can check it, but when you find it is set, you can clear it, then the next time, you will know the direction.&lt;/P&gt;&lt;P&gt;Before send and receive the CAN data, please do :&lt;/P&gt;&lt;P&gt;Chip_CCAN_ClearStatus(pCCAN, (CCAN_STAT_RXOK | CCAN_STAT_TXOK));&lt;/P&gt;&lt;P&gt;Then you can read the status in the interrupt routine, when the according bit is set, you can get the direction, then clear it immediately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;If you still have question, please let me know!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 May 2017 08:34:47 GMT</pubDate>
    <dc:creator>kerryzhou</dc:creator>
    <dc:date>2017-05-10T08:34:47Z</dc:date>
    <item>
      <title>LPC43xx CAN interrupt direction (LPCOpen)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC43xx-CAN-interrupt-direction-LPCOpen/m-p/671414#M26848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;what is the right way to identify whether the active CAN interrupt on LPC43xx is caused by message transmission or reception if I do not want to or can't keep track of which message object is used for tx/rx?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the interrupt routine I call &lt;A href="https://community.nxp.com/"&gt;Chip_CCAN_GetIntID&lt;/A&gt; (&lt;A href="https://community.nxp.com/"&gt;LPC_CCAN_T&lt;/A&gt; *pCCAN) that gives me the number of message object which is the source of the interrupt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I can read the status register using &lt;A href="https://community.nxp.com/"&gt;Chip_CCAN_GetStatus&lt;/A&gt; (&lt;A href="https://community.nxp.com/"&gt;LPC_CCAN_T&lt;/A&gt; *pCCAN) and use the TXOK and RXOK bits to detect if the interrupt was triggered by transmission or direction; however, both of these bits could be 1 at the same time which would prevent the direction identification.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other way I can think of would be using the &lt;A href="https://community.nxp.com/"&gt;Chip_CCAN_GetMsgObject&lt;/A&gt; function and then reading the DIR bit of the IFx_ARB2 register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any more elegant way? E.g. would it be possible to use the ND1/2 registers?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for any ideas / clarification&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 May 2017 13:30:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC43xx-CAN-interrupt-direction-LPCOpen/m-p/671414#M26848</guid>
      <dc:creator>quex</dc:creator>
      <dc:date>2017-05-08T13:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: LPC43xx CAN interrupt direction (LPCOpen)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC43xx-CAN-interrupt-direction-LPCOpen/m-p/671415#M26849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi quex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; You can refer to the LPCopen sample code, check the ID, because the transfer ID and receive ID is defined by the code, you can know it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Just like the LPCopen CAN0_IRQHandler code.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/19716iF1C29E4F0F2B913D/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; About the CCAN_STAT_TXOK and CCAN_STAT_RXOK question, you also can check it, but when you find it is set, you can clear it, then the next time, you will know the direction.&lt;/P&gt;&lt;P&gt;Before send and receive the CAN data, please do :&lt;/P&gt;&lt;P&gt;Chip_CCAN_ClearStatus(pCCAN, (CCAN_STAT_RXOK | CCAN_STAT_TXOK));&lt;/P&gt;&lt;P&gt;Then you can read the status in the interrupt routine, when the according bit is set, you can get the direction, then clear it immediately.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;If you still have question, please let me know!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 May 2017 08:34:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC43xx-CAN-interrupt-direction-LPCOpen/m-p/671415#M26849</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-05-10T08:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: LPC43xx CAN interrupt direction (LPCOpen)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC43xx-CAN-interrupt-direction-LPCOpen/m-p/671416#M26850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kerry,&lt;/P&gt;&lt;P&gt;thank you for your reply.&lt;/P&gt;&lt;P&gt;The approach in the example is fine for an example project where you know what identifiers are assigned to which direction. The code I'm working on is a driver which won't have the information. (It could be done by storing the data while the higher level application configures the MOBs, but it's quite complex and therefore rather impractical).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using RXOK &amp;amp; TXOK status bits would be the simplest way. However, I'm afraid there is a (remote) possibility that both could be set when I check them even if I clear them at every interrupt. E.g. if my application sends a message, NVIC fires an interrupt, but before I manage to check the status and clear the TXOK flag a new message gets received and sets the RXOK flag. Then I'd end up with both RXOK and TXOK set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Long story short: I decided to use the DIR bit of the IFx_ARB2 register, which seems to be the safe way to go.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 May 2017 09:50:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC43xx-CAN-interrupt-direction-LPCOpen/m-p/671416#M26850</guid>
      <dc:creator>quex</dc:creator>
      <dc:date>2017-05-12T09:50:37Z</dc:date>
    </item>
  </channel>
</rss>

