<?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のトピックRe: HCS12 INPUT CAPTURE ISSUE</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HCS12-INPUT-CAPTURE-ISSUE/m-p/492679#M12164</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ruby,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I suppose that you use S12XHY or S12XE family (according to your previous thread &lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2020" data-containertype="14" data-objectid="384422" data-objecttype="1" href="https://community.freescale.com/thread/384422"&gt;https://community.freescale.com/thread/384422&lt;/A&gt;&lt;SPAN&gt;). Is it correct?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If I understood correctly your description, the timer tick interrupt routine sometimes causes a delay in input capture interrupt processing. Correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We will assume for now that timer interrupt has the highest priority from all pending interrupts.&lt;/P&gt;&lt;P&gt;Interrupt latency to start timer interrupt is typically given mainly by sum of:&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;time to recognition of interrupt (typically 2 bus cycles for an external event)&lt;/LI&gt;&lt;LI&gt;time to finish previous interrupt routine if any is active&lt;/LI&gt;&lt;LI&gt;time to finish previous instruction (0..11 bus cycles)&lt;/LI&gt;&lt;LI&gt;time for exception processing (9 bus cycles)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both S12XHY and S12XE families contain Interrupt nesting feature - I bit maskable interrupt requests can be interrupted by an interrupt request with a higher priority.&lt;/P&gt;&lt;P&gt;I bit maskable interrupt requests cannot be interrupted by other I bit maskable interrupt requests per default. In order to make an interrupt service routine (ISR) interruptible, the ISR must explicitly clear the I bit in the CCR (CLI). After clearing the I bit, I bit maskable interrupt requests with higher priority can interrupt the current ISR.&lt;/P&gt;&lt;P&gt;In fact, the interrupt priority level must be greater than the current interrupt processing level in the condition code register (CCR) of the CPU (PRIOLVL[2:0] &amp;gt; IPL[2:0]).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, you may clear I bit at begin of timer tick interrupt (for example: asm ANDCC #0xEF; or asm CLI;). After that, this ISR may be interrupted by any I-bit interrupt with higher priority – like input capture interrupt.&lt;/P&gt;&lt;P&gt;Of course, the designer should know which code may be interrupted and which code cannot be interrupted (critical sections) – especially in RTOS system solution. For protection these critical sections you may set I-bit (by command asm SEI;) at begin and clear I-bit (by command asm CLI;) at end of the critical section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;RadekS&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>Mon, 23 May 2016 13:06:54 GMT</pubDate>
    <dc:creator>RadekS</dc:creator>
    <dc:date>2016-05-23T13:06:54Z</dc:date>
    <item>
      <title>HCS12 INPUT CAPTURE ISSUE</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HCS12-INPUT-CAPTURE-ISSUE/m-p/492678#M12163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are using Input capture in HCS12 family. We have some sporadic glitch in our time period calculation&lt;/P&gt;&lt;P&gt;Time period =( Overflow + present time stamp)- past time stamp&lt;/P&gt;&lt;P&gt;present time stamp is provided timer channel interrupt&lt;/P&gt;&lt;P&gt;Overflow is provided by timer overflow interrupt&lt;/P&gt;&lt;P&gt;We are using RTOS which uses timer tick interrupt which has a computation time of 30uS.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anybody faced issue in time period calculation owing to this interrupt overloading ?&lt;/P&gt;&lt;P&gt;Please clarify?&lt;/P&gt;&lt;P&gt;Is it evident in HCS12 controllers?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="150083_150083.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/121611i9FAD7B44CCB3B3DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="150083_150083.png" alt="150083_150083.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_0.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/4574i2D54530EA4525E2C/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_0.png" alt="pastedImage_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 May 2016 10:54:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HCS12-INPUT-CAPTURE-ISSUE/m-p/492678#M12163</guid>
      <dc:creator>rubykrishna</dc:creator>
      <dc:date>2016-05-23T10:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: HCS12 INPUT CAPTURE ISSUE</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HCS12-INPUT-CAPTURE-ISSUE/m-p/492679#M12164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ruby,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I suppose that you use S12XHY or S12XE family (according to your previous thread &lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2020" data-containertype="14" data-objectid="384422" data-objecttype="1" href="https://community.freescale.com/thread/384422"&gt;https://community.freescale.com/thread/384422&lt;/A&gt;&lt;SPAN&gt;). Is it correct?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If I understood correctly your description, the timer tick interrupt routine sometimes causes a delay in input capture interrupt processing. Correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We will assume for now that timer interrupt has the highest priority from all pending interrupts.&lt;/P&gt;&lt;P&gt;Interrupt latency to start timer interrupt is typically given mainly by sum of:&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;time to recognition of interrupt (typically 2 bus cycles for an external event)&lt;/LI&gt;&lt;LI&gt;time to finish previous interrupt routine if any is active&lt;/LI&gt;&lt;LI&gt;time to finish previous instruction (0..11 bus cycles)&lt;/LI&gt;&lt;LI&gt;time for exception processing (9 bus cycles)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both S12XHY and S12XE families contain Interrupt nesting feature - I bit maskable interrupt requests can be interrupted by an interrupt request with a higher priority.&lt;/P&gt;&lt;P&gt;I bit maskable interrupt requests cannot be interrupted by other I bit maskable interrupt requests per default. In order to make an interrupt service routine (ISR) interruptible, the ISR must explicitly clear the I bit in the CCR (CLI). After clearing the I bit, I bit maskable interrupt requests with higher priority can interrupt the current ISR.&lt;/P&gt;&lt;P&gt;In fact, the interrupt priority level must be greater than the current interrupt processing level in the condition code register (CCR) of the CPU (PRIOLVL[2:0] &amp;gt; IPL[2:0]).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, you may clear I bit at begin of timer tick interrupt (for example: asm ANDCC #0xEF; or asm CLI;). After that, this ISR may be interrupted by any I-bit interrupt with higher priority – like input capture interrupt.&lt;/P&gt;&lt;P&gt;Of course, the designer should know which code may be interrupted and which code cannot be interrupted (critical sections) – especially in RTOS system solution. For protection these critical sections you may set I-bit (by command asm SEI;) at begin and clear I-bit (by command asm CLI;) at end of the critical section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I hope it helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;RadekS&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>Mon, 23 May 2016 13:06:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HCS12-INPUT-CAPTURE-ISSUE/m-p/492679#M12164</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2016-05-23T13:06:54Z</dc:date>
    </item>
  </channel>
</rss>

