<?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 Hardware Watchdog ISR in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hardware-Watchdog-ISR/m-p/1196396#M59085</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;May I kindly ask for an advice.&lt;/P&gt;&lt;P&gt;Working on HW Watchdog via LPO on&amp;nbsp;&lt;A href="https://www.nxp.com/files/32bit/doc/ref_manual/K20P81M100SF2V2RM.pdf" rel="nofollow" target="_blank"&gt;MK20DN512VLK10&lt;/A&gt;.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;WDOG_UNLOCK&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;0xC520&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;WDOG_UNLOCK&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;0xD928&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;WDOG_PRESC&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;WDOG_PRESC_PRESCVAL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;WDOG_TOVALH&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN&gt;3000&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;gt;&amp;gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;16&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;SPAN&gt;WDOG_TOVALL&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;(&lt;/SPAN&gt;&lt;SPAN&gt;4000&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;DIV&gt;&lt;SPAN&gt;WDOG_STCTRLH&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;0x1D5&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Please, advice the correct steps to add and configure IRQ function to be called when the watchdog timeout happens.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Dec 2020 12:36:37 GMT</pubDate>
    <dc:creator>Oleksii</dc:creator>
    <dc:date>2020-12-09T12:36:37Z</dc:date>
    <item>
      <title>Hardware Watchdog ISR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hardware-Watchdog-ISR/m-p/1196396#M59085</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;May I kindly ask for an advice.&lt;/P&gt;&lt;P&gt;Working on HW Watchdog via LPO on&amp;nbsp;&lt;A href="https://www.nxp.com/files/32bit/doc/ref_manual/K20P81M100SF2V2RM.pdf" rel="nofollow" target="_blank"&gt;MK20DN512VLK10&lt;/A&gt;.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt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&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Please, advice the correct steps to add and configure IRQ function to be called when the watchdog timeout happens.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 12:36:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hardware-Watchdog-ISR/m-p/1196396#M59085</guid>
      <dc:creator>Oleksii</dc:creator>
      <dc:date>2020-12-09T12:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Hardware Watchdog ISR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hardware-Watchdog-ISR/m-p/1196417#M59086</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;You just need to unmask the interrupt in the NVIC.&lt;/P&gt;&lt;P&gt;Here is the code from the uTasker project:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;fnEnterInterrupt(irq_WDOG_ID, 0, wdog_irq); // enable WDOG interrupt (highest priority) and enter handler&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;static __interrupt void wdog_irq(void)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;WDOG_STCTRLL = (WDOG_STCTRLL_INTFLG | WDOG_STCTRLL_RES1); // clear interrupt flag&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;*BOOT_MAIL_BOX = 0x9876; // set a pattern to the boot mailbox to show that the watchdog interrupt took place&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mark&lt;BR /&gt;&lt;EM&gt;[uTasker project developer for Kinetis and i.MX RT]&lt;/EM&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;Contact me by personal message or on the uTasker web site to discuss professional training, solutions to problems or rapid product development requirements&lt;BR /&gt;&lt;BR /&gt;For professionals searching for faster, problem-free Kinetis and i.MX RT 10xx developments the uTasker project holds the key&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 13:01:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hardware-Watchdog-ISR/m-p/1196417#M59086</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2020-12-09T13:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Hardware Watchdog ISR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hardware-Watchdog-ISR/m-p/1196426#M59087</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Kind of strange that I do not have this func in my repository.&lt;/P&gt;&lt;P&gt;fnEnterInterrupt is a part of some library ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 13:16:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hardware-Watchdog-ISR/m-p/1196426#M59087</guid>
      <dc:creator>Oleksii</dc:creator>
      <dc:date>2020-12-09T13:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Hardware Watchdog ISR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hardware-Watchdog-ISR/m-p/1196560#M59089</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;The function is use in the uTasker project to unmask interrupts and enter a user handler in the vector table (in RAM). You can work out the instructions from below and the complete Kinetis project is open source at this repository: &lt;A href="https://github.com/uTasker/uTasker-Kinetis" target="_blank"&gt;https://github.com/uTasker/uTasker-Kinetis&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Function used to enter processor interrupts
//
extern void fnEnterInterrupt(int iInterruptID, unsigned char ucPriority, void (*InterruptFunc)(void))
{
    volatile unsigned long *ptrIntSet = IRQ0_31_SER_ADD;
#if defined ARM_MATH_CM0PLUS                                             // only long word accesses are possible to the priority registers
    volatile unsigned long *ptrPriority = (unsigned long *)IRQ0_3_PRIORITY_REGISTER_ADD;
    int iShift;
#else
    volatile unsigned char *ptrPriority = IRQ0_3_PRIORITY_REGISTER_ADD;
#endif
    VECTOR_TABLE *ptrVect = (VECTOR_TABLE *)VECTOR_TABLE_OFFSET_REG;
    void (**processor_ints)(void);
    processor_ints = (void (**)(void))&amp;amp;ptrVect-&amp;gt;processor_interrupts;    // first processor interrupt location in the vector table
    processor_ints += iInterruptID;                                      // move the pointer to the location used by this interrupt number
    *processor_ints = InterruptFunc;                                     // enter the interrupt handler into the vector table
#if defined ARM_MATH_CM0PLUS
    ptrPriority += (iInterruptID/4);                                     // move to the priority location used by this interrupt
    iShift = ((iInterruptID % 4) * 8);
    *ptrPriority = ((*ptrPriority &amp;amp; ~(0xff &amp;lt;&amp;lt; iShift)) | (ucPriority &amp;lt;&amp;lt; (iShift + __NVIC_PRIORITY_SHIFT)));
#else
    ptrPriority += iInterruptID;                                         // move to the priority location used by this interrupt
    *ptrPriority = (ucPriority &amp;lt;&amp;lt; __NVIC_PRIORITY_SHIFT);                // define the interrupt's priority (16 levels for Cortex-m4 and 4 levels for Cortex-m0+)
#endif
    ptrIntSet += (iInterruptID/32);                                      // move to the interrupt enable register in which this interrupt is controlled
    *ptrIntSet = (0x01 &amp;lt;&amp;lt; (iInterruptID % 32));                          // enable the interrupt
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 15:41:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hardware-Watchdog-ISR/m-p/1196560#M59089</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2020-12-09T15:41:23Z</dc:date>
    </item>
  </channel>
</rss>

