<?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: NVIC_DisableIrq latency? Inline but needs delay. in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/NVIC-DisableIrq-latency-Inline-but-needs-delay/m-p/573094#M18722</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by pierre on Mon Apr 08 00:16:44 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;P&gt;You need to set the frequency and enable the base and branch clocks for SGPIO, but you've probably done this already..&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Datasheet mentions the latency for reads and writes to SGPIO registers, which is quite large, and includes 2-4 SGPIO clocks.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thus, if your SGPIO clock is slow (in my case it was 25 MHz) relative to main cpu clock, SGPIO register writes will be extremely slow, making the SGPIO IRQ a major cpu hog. Solution is increasing SGPIO frequency and playing with the dividers.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Anyway, I'd like to see the rest of your code, especially the part with the NVIC_EnableIRQ. Here you disable the IRQ and complain it doesn't work, but I guess you must call NVIC_EnableIRQ somewhere... perhaps the delay plays with the interaction of&amp;nbsp;NVIC_EnableIRQ and the enabling of interrupts in the SGPIO registers ? I did not have this problem. Strange.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:55:49 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:55:49Z</dc:date>
    <item>
      <title>NVIC_DisableIrq latency? Inline but needs delay.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/NVIC-DisableIrq-latency-Inline-but-needs-delay/m-p/573092#M18720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by h11angel on Thu Mar 28 05:26:41 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi guys.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Long story short, I was trying to enable an interrupt for the SGPIO when I observed the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If a certain number of neutral cycles are not inserted between&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;NVIC_DisableIRQ(Periph_IRQn)&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;and&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;LPC_Periph-&amp;gt;SET_EN_PeriphInt = (PeriphIntMask);&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;the interrupt will not be enabled.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to enable my interrupt for the SGPIO I was forced to use:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;NVIC_DisableIRQ(SGPIO_IINT_IRQn);&lt;BR /&gt;[color=red]for (int i=0;i&amp;lt;5;i++);[/color]&lt;BR /&gt;LPC_SGPIO-&amp;gt;SET_EN_0 = (1&amp;lt;&amp;lt;DATA_CFG0.sliceId);&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used a human powered binary search to find the value for i&amp;lt;5;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This, when disassembled, translates into 1 cycle for loading i, 5 compares, 5 branch-lesser-than's and 1 last compare. In total of 12 cycles. With 10 cycles it still doesn't work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My LPC4330 is running at 204MHz and I'm debugging using the IAR-Jlink toolchain. Now, I don't remember reading about this delay in neither the CM3 or the CM4 user manuals.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anybody know what this is all about? If not, watch out for this if you can't enable your interrupts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:55:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/NVIC-DisableIrq-latency-Inline-but-needs-delay/m-p/573092#M18720</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: NVIC_DisableIrq latency? Inline but needs delay.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/NVIC-DisableIrq-latency-Inline-but-needs-delay/m-p/573093#M18721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by suckfish on Mon Apr 01 19:20:08 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;How is the clocking set up for SGPIO in the CGU &amp;amp; CCU?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My reading of the user manual is that SGPIO is clocked by the 12MHz IRC clock by default &amp;amp; that could explain a dozen cycles or so of latency in interrupt set-up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you haven't already, you could try changing the BASE_PERIPH_CLOCK to the same clock as the CPU and see if that makes any difference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, thanks for the heads up on this, that's the sort of unexpected little issue that can cause days of head scratching!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:55:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/NVIC-DisableIrq-latency-Inline-but-needs-delay/m-p/573093#M18721</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: NVIC_DisableIrq latency? Inline but needs delay.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/NVIC-DisableIrq-latency-Inline-but-needs-delay/m-p/573094#M18722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by pierre on Mon Apr 08 00:16:44 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;P&gt;You need to set the frequency and enable the base and branch clocks for SGPIO, but you've probably done this already..&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Datasheet mentions the latency for reads and writes to SGPIO registers, which is quite large, and includes 2-4 SGPIO clocks.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thus, if your SGPIO clock is slow (in my case it was 25 MHz) relative to main cpu clock, SGPIO register writes will be extremely slow, making the SGPIO IRQ a major cpu hog. Solution is increasing SGPIO frequency and playing with the dividers.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Anyway, I'd like to see the rest of your code, especially the part with the NVIC_EnableIRQ. Here you disable the IRQ and complain it doesn't work, but I guess you must call NVIC_EnableIRQ somewhere... perhaps the delay plays with the interaction of&amp;nbsp;NVIC_EnableIRQ and the enabling of interrupts in the SGPIO registers ? I did not have this problem. Strange.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:55:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/NVIC-DisableIrq-latency-Inline-but-needs-delay/m-p/573094#M18722</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:55:49Z</dc:date>
    </item>
  </channel>
</rss>

