<?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 fsl_mcan losing interrupts in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943290#M37558</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We use the fsl_mcan driver below our CANopen stack and the driver is not handling interrupts correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;We see that the sometimes when interrupts handler is called the interrupts are not correctly copied from the IR register. When we set a breakpoint behind this copy the IR register is filled with interrupts and the variable is zero.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that after a few minutes the driver stops with sending messages because the cancellation is not finished. The driver comes back when the first bit in the TXBAR register is set. The adds a new request which clears all the pending flags when finished and runs again for a while until it happen again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far we changed the interrupt handler that only the handled interrupts are cleared. And we added the following in the handler of the Tx complete:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/83337iC1CB7143DF5D82CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This delays the problem. Without the above fix it will last an hour and otherwise it will last a few minutes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Sep 2019 07:04:36 GMT</pubDate>
    <dc:creator>teus</dc:creator>
    <dc:date>2019-09-19T07:04:36Z</dc:date>
    <item>
      <title>fsl_mcan losing interrupts</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943290#M37558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We use the fsl_mcan driver below our CANopen stack and the driver is not handling interrupts correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;We see that the sometimes when interrupts handler is called the interrupts are not correctly copied from the IR register. When we set a breakpoint behind this copy the IR register is filled with interrupts and the variable is zero.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that after a few minutes the driver stops with sending messages because the cancellation is not finished. The driver comes back when the first bit in the TXBAR register is set. The adds a new request which clears all the pending flags when finished and runs again for a while until it happen again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far we changed the interrupt handler that only the handled interrupts are cleared. And we added the following in the handler of the Tx complete:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/83337iC1CB7143DF5D82CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This delays the problem. Without the above fix it will last an hour and otherwise it will last a few minutes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2019 07:04:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943290#M37558</guid>
      <dc:creator>teus</dc:creator>
      <dc:date>2019-09-19T07:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: fsl_mcan losing interrupts</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943291#M37559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Teus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some question regarding this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which baudrate are you using?&lt;/P&gt;&lt;P&gt;Which is the state of the FIFOs when this error appears? Is it full?&lt;/P&gt;&lt;P&gt;Which is the value of the error counter register (ECR) when this error appears?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Alexis Andalon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Sep 2019 21:25:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943291#M37559</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2019-09-23T21:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: fsl_mcan losing interrupts</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943292#M37560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Alexis,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help at first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The baudrate that we are using is 250 kbits&lt;/LI&gt;&lt;LI&gt;We are not using the FIFO's of the pheripheral. We only use 1 transmit register and wait until that register is done before we send the next packet through the same register.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;The value of the register ECR is 0&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more information about the register see the screenshots in the appendix / below. CAN1 is the pheripheral with the problems. The screenshots are taken on the moment the problem happend.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Teus&lt;span class="lia-inline-image-display-wrapper" image-alt="screenshot_can_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/89411i5F4A2695522E471E/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot_can_1.png" alt="screenshot_can_1.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="screenshot_can_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/89453i6DB1EDD109F226DE/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot_can_2.png" alt="screenshot_can_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Sep 2019 09:46:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943292#M37560</guid>
      <dc:creator>teus</dc:creator>
      <dc:date>2019-09-24T09:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: fsl_mcan losing interrupts</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943293#M37561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Teus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I could check in the registers of the CAN1 you have a FIFO with size of eight elements, and is full in the moment in which the error is present. Check the&amp;nbsp;RXF0C and the&amp;nbsp;RXF0S to confirm this information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I think something is wrong with the stack you're using. I will suggest to put a watermark in the FIFO and enable the interruption to see when this being filled more that what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Alexis Andalon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Sep 2019 22:01:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943293#M37561</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2019-09-27T22:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: fsl_mcan losing interrupts</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943294#M37562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FYI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We figured something out and that is solving this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have seen that sometimes the interrupt handler was called with the IR register not set. Probably that are the tx interrupts that we are missing.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;We added the following code in the interrupt handler:&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/95740i37056CB8630A5FD2/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;&lt;/P&gt;&lt;P&gt;The implementation of the MCAN_FinalizeTransmit function is as follows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_4.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/95741iBC177D0658AC087B/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_4.png" alt="pastedImage_4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To be completely sure we also call MCAN_FinalizeTransmit when an rx interupt occurs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2019 06:25:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/fsl-mcan-losing-interrupts/m-p/943294#M37562</guid>
      <dc:creator>teus</dc:creator>
      <dc:date>2019-10-04T06:25:56Z</dc:date>
    </item>
  </channel>
</rss>

