<?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>Kinetis Microcontrollers中的主题 Re: Interrupts disabled erroneously in Freescale USB Stack examples</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233119#M5249</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please forgive my ignorance, but is this something that would affect the Freedom board when one is constantly using the USB and reading and writing to lots of GPIOs?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been struggling for a week to get stable USB reads and writes while also constantly reading and setting IO pins. I had assumed it was my code, or timing or something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would this issue apply to the Freedom board, or do I need to keep looking elsewhere?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Jan 2013 20:46:42 GMT</pubDate>
    <dc:creator>injunear1</dc:creator>
    <dc:date>2013-01-25T20:46:42Z</dc:date>
    <item>
      <title>Interrupts disabled erroneously in Freescale USB Stack examples</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233116#M5246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This took me ages to find and might be the reason why there are so many questions on this forum about interrupts not working properly...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I incorporated the Freescale USB Stack v4.0.2 into my project.&amp;nbsp; It works just fine as a USB Device but causes problems with the GPIO interrupts I also need.&amp;nbsp; Following my start-up code in my debugger I could see that my GPIO interrupts were being configured correctly but, as soon as I ran the USB_init() function, all my existing interrupts were being disabled and only the USB interrupt was enabled.&amp;nbsp; And here's why...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;USBinit contains two coding errors in this line :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NVICICER2 |= (1 &amp;lt;&amp;lt; 9);&amp;nbsp;&amp;nbsp; /* Clear any pending interrupts on USB */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) It calls NVICICERx instead of NVICICPRx to clear pending interrupts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While ICER (Interrupt Clear Enabled Register) disables interrupts, this would not be harmful on its own, but it was the way it was coded which caused the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) NVICICERx was being used with&amp;nbsp; |=&amp;nbsp; so it was reading the state of all existing interrupts, ORing those with the USB interrupt, then writing those bits back to ICER.&amp;nbsp; So all existing interrupts were being disabled.&amp;nbsp; The following line was just enabling the USB interrupt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NVICICERx is a write-to-clear register so all we need to do to clear a single interrupt is to write a one in that particular bit position.&amp;nbsp; All zeros are ignored.&amp;nbsp; Other NVIC registers work in a similar way with both SET and CLEAR variants.&amp;nbsp; Using OR is wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did a search of my project and found this error scattered throughout the Freescale examples.&amp;nbsp; I also found the same code being used to reset the Interrupt Status Flags (PORTx_ISFR), ie, using&amp;nbsp; |=&amp;nbsp; when we should just use&amp;nbsp; =&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be honest this is not something I wouldn't have expected from Freescale, but having read other reports of demos not working, I can now see the error in that assumption.&amp;nbsp; So please Freescale, get this fixed because wasting programmers time is a frustrating and costly exercise...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 11:44:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233116#M5246</guid>
      <dc:creator>neillewis</dc:creator>
      <dc:date>2013-01-22T11:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupts disabled erroneously in Freescale USB Stack examples</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233117#M5247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for reporting this error. We acknowledge that there is an issue and it will be fixed in the next release.&lt;SPAN class="st"&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 15:17:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233117#M5247</guid>
      <dc:creator>florintoma</dc:creator>
      <dc:date>2013-01-22T15:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupts disabled erroneously in Freescale USB Stack examples</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233118#M5248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2013 17:29:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233118#M5248</guid>
      <dc:creator>neillewis</dc:creator>
      <dc:date>2013-01-22T17:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupts disabled erroneously in Freescale USB Stack examples</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233119#M5249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please forgive my ignorance, but is this something that would affect the Freedom board when one is constantly using the USB and reading and writing to lots of GPIOs?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been struggling for a week to get stable USB reads and writes while also constantly reading and setting IO pins. I had assumed it was my code, or timing or something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would this issue apply to the Freedom board, or do I need to keep looking elsewhere?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 20:46:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233119#M5249</guid>
      <dc:creator>injunear1</dc:creator>
      <dc:date>2013-01-25T20:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupts disabled erroneously in Freescale USB Stack examples</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233120#M5250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have found a suspicious line in the generated file "usb1.c" which reads:&lt;/P&gt;&lt;P&gt;NVIC_ICER |= (1&amp;lt;&amp;lt;24);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this error is relevant to the KL25Z Freedom board, can it be corrected somewhere?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or, does it not apply to USB Stack v4.0.3 and/or the Freedom board?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Advice gratefully accepted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Jan 2013 02:21:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233120#M5250</guid>
      <dc:creator>injunear1</dc:creator>
      <dc:date>2013-01-26T02:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupts disabled erroneously in Freescale USB Stack examples</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233121#M5251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for answering that for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Jan 2013 04:37:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233121#M5251</guid>
      <dc:creator>injunear1</dc:creator>
      <dc:date>2013-01-26T04:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupts disabled erroneously in Freescale USB Stack examples</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233122#M5252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're wrong Jim...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NVIC_ICER |= (1&amp;lt;&amp;lt;24);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the Interrrupt Clear Enabled Register and is exactly what I mentioned in my first post.&amp;nbsp; To fix this you must remove the | (OR) symbol and use just = (EQUALS).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that I also found some lines structured like this:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ICER = ICER | (1&amp;lt;&amp;lt;24);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This has exactly the same effect as&amp;nbsp; |=&amp;nbsp; and should be replaced by:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ICER = (1&amp;lt;&amp;lt;24);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2013 09:14:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233122#M5252</guid>
      <dc:creator>neillewis</dc:creator>
      <dc:date>2013-01-28T09:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupts disabled erroneously in Freescale USB Stack examples</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233123#M5253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Neil,&lt;/P&gt;&lt;P&gt;You are correct. I mis-read it.&lt;/P&gt;&lt;P&gt;Thanks for catching that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2013 15:08:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Interrupts-disabled-erroneously-in-Freescale-USB-Stack-examples/m-p/233123#M5253</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2013-01-28T15:08:26Z</dc:date>
    </item>
  </channel>
</rss>

