<?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>MQX Software Solutions中的主题 Re: MQX Watchdogs for Multiple Tasks</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-Watchdogs-for-Multiple-Tasks/m-p/268329#M8150</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brent,&lt;/P&gt;&lt;P&gt;It has been awhile since I have played with the MQX watchdog.&lt;/P&gt;&lt;P&gt;MQX has a capability to implement task watchdog timers (reference ~mqx/examples/watchdog) that will ensure task do not fail and if they do then an ISR routine is called and decision as what to do can be done (ex: reset device, kill task and try reset, log stuff, etc.).&amp;nbsp; The example simply logs to terminal which task failed.&amp;nbsp; I enhanced the code to work with multiple tasks as originally it was working with only one.&lt;BR /&gt;I've attached that example.&amp;nbsp; Note it is old and I last ran it on a ColdFire using MQX3.6 so it may need tweaking.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Jan 2014 17:26:41 GMT</pubDate>
    <dc:creator>DavidS</dc:creator>
    <dc:date>2014-01-30T17:26:41Z</dc:date>
    <item>
      <title>MQX Watchdogs for Multiple Tasks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-Watchdogs-for-Multiple-Tasks/m-p/268328#M8149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Hi David,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;The MQX RTOS documentation states the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-left: .5in; margin-bottom: .0001pt;"&gt;&lt;SPAN style="background: yellow;"&gt;The MQX watchdog component provides a software watchdog for each task&lt;/SPAN&gt;. If a single&lt;/P&gt;&lt;P style="margin-left: .5in; margin-bottom: .0001pt;"&gt;task starves or runs beyond certain timing constraints, the watchdog provides a way to&lt;/P&gt;&lt;P style="margin-left: .5in; margin-bottom: .0001pt;"&gt;detect the problem. Initially, the task starts its watchdog with a specific time value, and if&lt;/P&gt;&lt;P style="margin-left: .5in; margin-bottom: .0001pt;"&gt;the task fails to stop or restart the watchdog before that time expires, MQX calls a&lt;/P&gt;&lt;P style="margin-left: .5in; margin-bottom: .0001pt;"&gt;processor-unique, application-supplied expiry function that can initiate error recovery.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-left: .5in; margin-bottom: .0001pt;"&gt;Before a task can use the watchdog component, the application must explicitly create it&lt;/P&gt;&lt;P style="margin-left: .5in; margin-bottom: .0001pt;"&gt;by calling _watchdog_create_component() &lt;SPAN style="background: yellow;"&gt;with the interrupt vector of the periodic&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-left: .5in; margin-bottom: .0001pt;"&gt;&lt;SPAN style="background: yellow;"&gt;timer device&lt;/SPAN&gt; and a pointer to the function that MQX will call, if a watchdog expires.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;When first reading this it states “&lt;STRONG style="text-decoration: underline;"&gt;the&lt;/STRONG&gt; interrupt vector” implying that you can have multiple watchdog expiry functions (one for each task) associated with BSP_TIMER_INTERRUPT_VECTOR.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt; background: white;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;But this is not the case, the &lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;watchdog component can register only one function to the interrupt vector.&amp;nbsp; The second time it fails because it was initialized already.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: white;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 0 0.5in; background-color: white;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt; _lwsem_wait((LWSEM_STRUCT_PTR)(&amp;amp;kernel_data-&amp;gt;COMPONENT_CREATE_LWSEM));&lt;BR /&gt; if (kernel_data-&amp;gt;KERNEL_COMPONENTS[KERNEL_WATCHDOG] != NULL) {&lt;BR /&gt;&amp;nbsp; _lwsem_post((LWSEM_STRUCT_PTR)(&amp;amp;kernel_data-&amp;gt;COMPONENT_CREATE_LWSEM));&lt;BR /&gt; _KLOGX2(KLOG_watchdog_create_component, MQX_OK);&lt;BR /&gt; return(MQX_OK);&lt;BR /&gt; } /* Endif */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;I am not sure how this would work for multiple tasks with just the one associated timer interrupt vector (BSP_TIMER_INTERRUPT_VECTOR)??&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;If you have multiple tasks running and they are all "petting" the same watchdog timer, one task could be stuck while others are just fine and refresh the watchdog.&amp;nbsp; As a result, a stuck task will not cause the watchdog to go off.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Any insight would be appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;Brent&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jan 2014 20:40:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-Watchdogs-for-Multiple-Tasks/m-p/268328#M8149</guid>
      <dc:creator>brentwilliams</dc:creator>
      <dc:date>2014-01-28T20:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: MQX Watchdogs for Multiple Tasks</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-Watchdogs-for-Multiple-Tasks/m-p/268329#M8150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brent,&lt;/P&gt;&lt;P&gt;It has been awhile since I have played with the MQX watchdog.&lt;/P&gt;&lt;P&gt;MQX has a capability to implement task watchdog timers (reference ~mqx/examples/watchdog) that will ensure task do not fail and if they do then an ISR routine is called and decision as what to do can be done (ex: reset device, kill task and try reset, log stuff, etc.).&amp;nbsp; The example simply logs to terminal which task failed.&amp;nbsp; I enhanced the code to work with multiple tasks as originally it was working with only one.&lt;BR /&gt;I've attached that example.&amp;nbsp; Note it is old and I last ran it on a ColdFire using MQX3.6 so it may need tweaking.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2014 17:26:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MQX-Watchdogs-for-Multiple-Tasks/m-p/268329#M8150</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2014-01-30T17:26:41Z</dc:date>
    </item>
  </channel>
</rss>

