<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>RTX task unresponsive. Power cycle doesn&amp;#39;t help, but reset does.</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/39947/rtx-task-unresponsive-power-cycle-doesn-t-help-but-reset-does</link><description> 
Hi, All! 

 
I am dealing with the most obscure bug I have ever
encountered. 
I am using LPC2144, Keil RTX and MDK 4.60. 
I have a task waiting for event (forever) that is triggered by a pin
state transition. The pin transition is detected with CAP0</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: RTX task unresponsive. Power cycle doesn't help, but reset does.</title><link>https://community.arm.com/thread/140423?ContentTypeID=1</link><pubDate>Mon, 29 Oct 2012 19:19:14 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:77889f17-37f6-4de3-882e-64e4ee9becc1</guid><dc:creator>John Linq</dc:creator><description>&lt;p&gt;&lt;p&gt;
[ Should I start giving up? ]&lt;/p&gt;

&lt;p&gt;
I think that, you already get everything you may need to solve
this problem.&lt;br /&gt;
1. You can reproduce the problem 100% successfully.&lt;br /&gt;
2. You already find some clues about the problem, something like an
unexpected interrupt was triggered.&lt;/p&gt;

&lt;p&gt;
What you need is just to take a break, calm down, then get back
with patience.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTX task unresponsive. Power cycle doesn't help, but reset does.</title><link>https://community.arm.com/thread/136904?ContentTypeID=1</link><pubDate>Sun, 28 Oct 2012 15:14:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:87610cab-ae69-422b-9661-0f606a4ff58a</guid><dc:creator>Matic Herman</dc:creator><description>&lt;p&gt;&lt;p&gt;
And even more... If I and prepare both CAPTURE channels as
mentioned above, but keep old definitions (enable only the CAP0
interrupt), the program does NOT work after reset/programming, but it
DOES work after power cycle.&lt;/p&gt;

&lt;p&gt;
Should I start giving up?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTX task unresponsive. Power cycle doesn't help, but reset does.</title><link>https://community.arm.com/thread/127845?ContentTypeID=1</link><pubDate>Sun, 28 Oct 2012 15:07:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:24eadb7a-b79f-4447-8506-395a69ceb00b</guid><dc:creator>Matic Herman</dc:creator><description>&lt;p&gt;&lt;p&gt;
This is getting more and more ridiculous. Adding CAP0.3 to do the
same thing as CAP0.0 solves the problem. And all I did were these 4
changes :&lt;/p&gt;

&lt;p&gt;
Initialization&lt;/p&gt;

&lt;pre&gt;
//T0CCR = (1&amp;lt;&amp;lt;0);
T0CCR = (1&amp;lt;&amp;lt;0) | (1&amp;lt;&amp;lt;9);

//PINSEL1 |= (2&amp;lt;&amp;lt;12);
PINSEL1 |= (2&amp;lt;&amp;lt;12)|(2&amp;lt;&amp;lt;26);
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Global definitions&lt;/p&gt;

&lt;pre&gt;
#define T0_CAP0EN() T0CCR |= (1&amp;lt;&amp;lt;2) | (1&amp;lt;&amp;lt;11)
#define T0_CAP0DIS() T0CCR &amp;amp;= ~(1&amp;lt;&amp;lt;2) | (1&amp;lt;&amp;lt;11)
//#define T0_CAP0EN() T0CCR |= (1&amp;lt;&amp;lt;2)
//#define T0_CAP0DIS() T0CCR &amp;amp;= ~(1&amp;lt;&amp;lt;2)
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
T0 Interrupt&lt;/p&gt;

&lt;pre&gt;
// Capture0 interrupt
if ((IR==(1&amp;lt;&amp;lt;4)) || (IR==(1&amp;lt;&amp;lt;7)))   // Cap0 or Cap3 interrupt
//if ((IR==(1&amp;lt;&amp;lt;4)))
&lt;/pre&gt;

&lt;p&gt;
Any ideas?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTX task unresponsive. Power cycle doesn't help, but reset does.</title><link>https://community.arm.com/thread/117062?ContentTypeID=1</link><pubDate>Sun, 28 Oct 2012 14:53:44 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3ce68d4d-1bac-4b5f-9579-45a05870ac32</guid><dc:creator>Matic Herman</dc:creator><description>&lt;p&gt;&lt;p&gt;
No luck. Changing to a series of ifs still never triggers an
interrupt after the first powerdown. However, adding the default case
with clearing all interrupts in previous switch version miraculously
solved the problem. But if that worked this should work too!!! This
is one spooky piece of a microcontroller.&lt;/p&gt;

&lt;pre&gt;
__irq void timer0_irq()
{
        int IR = T0IR;
        // ........................................................................
        // Match1 interrupt
        if (IR==(1&amp;lt;&amp;lt;1))                   // match1 (MR1)
        {
                        isr_evt_set(TSK_CLK_RESUME,t_clock);    //Resume clock task to update the display
                        //T0IR=(1&amp;lt;&amp;lt;1);            // Clear MR1 Interrupt
        }
        // ........................................................................
        // Match2 interrupt
        if (IR==(1&amp;lt;&amp;lt;2))   // match2 (MR2) - Timeout after THRE
        {
                TXCLR();        // Clear RS485 TX line
                T0_MR2DIS();    // Disable Match2
                //T0IR=(1&amp;lt;&amp;lt;2);
        }
        // ........................................................................
        // Capture0 interrupt

        if ((IR==(1&amp;lt;&amp;lt;4))) // Cap0 interrupt
        {
                isr_evt_set(TSK_COMMAND_REQUEST_ISR,t_command); // Slave requested action
                if (t_idleled != 0)     // Task t_idleled exists
                        isr_evt_set(TSK_SIGNAL_LED,t_idleled);  // Signal Sync1 transition
                T0_CAP0DIS();           // Disable triggering until response is provided
                //T0IR=(1&amp;lt;&amp;lt;4);
        }
        T0IR=(0xFF);    // All cases handeled, clear all interrupt flags
        VICVectAddr = 0;   /* Acknowledge Interrupt               */
}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTX task unresponsive. Power cycle doesn't help, but reset does.</title><link>https://community.arm.com/thread/106524?ContentTypeID=1</link><pubDate>Sun, 28 Oct 2012 07:44:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2e780571-ea38-4c13-892c-8f4bbc60448b</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Maybe it doesn&amp;#39;t like the situations when T0IR contains multiple
set bits, and your ISR then doesn&amp;#39;t handle any of them because of
your design with a switch statement.&lt;/p&gt;

&lt;p&gt;
Better to have individual if statements for each bit.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTX task unresponsive. Power cycle doesn't help, but reset does.</title><link>https://community.arm.com/thread/80690?ContentTypeID=1</link><pubDate>Sun, 28 Oct 2012 06:40:09 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:68fb201e-8b2f-4f38-bec5-70a65aec9a9c</guid><dc:creator>Matic Herman</dc:creator><description>&lt;p&gt;&lt;pre&gt;
__irq void timer0_irq()
{
        switch (T0IR)
        {
                case (1&amp;lt;&amp;lt;1):                                              // match1 (MR1)

                        isr_evt_set(TSK_CLK_RESUME,t_clock);    //Resume clock task to update the display
                        T0IR=(1&amp;lt;&amp;lt;1);                                      // Clear MR1 Interrupt
                        break;

                // ........................................................................
                // Match2 interrupt
                case (1&amp;lt;&amp;lt;2):                                              // match2 (MR2) - Timeout after THRE
                        TXCLR();                                        // Clear RS485 TX line
                        T0_MR2DIS();                                    // Disable Match2
                        T0IR=(1&amp;lt;&amp;lt;2);
                break;
                // ........................................................................
                // Capture0 interrupt
                case (1&amp;lt;&amp;lt;4):              // Cap0 interrupt
                        isr_evt_set(TSK_COMMAND_REQUEST_ISR,t_command); //Slave requested action
                        T0_CAP0DIS();                   // Disable triggering until response is provided
                T0IR=(1&amp;lt;&amp;lt;4);                              // Clear cap0 interrupt
                LED_TOGGLE(1);
        }
        VICVectAddr = 0;                    /* Acknowledge Interrupt               */
}
&lt;/pre&gt;

&lt;p&gt;
Initialization routine includes proper T0 initialization including
Cap0.0 enable, and PINSEL. (Of-course, otherwise reset wouldn&amp;#39;t solve
the problem!)&lt;/p&gt;

&lt;p&gt;
Thanks for your time!&lt;/p&gt;

&lt;p&gt;
Matic&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTX task unresponsive. Power cycle doesn't help, but reset does.</title><link>https://community.arm.com/thread/67814?ContentTypeID=1</link><pubDate>Sun, 28 Oct 2012 06:26:47 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1d1aa600-725e-46e6-9d7b-bf8eefa9b87e</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
So what does your code look like that acknowledges the
interrupt?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>