TIMER1_IRQHandler does not interrupt?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TIMER1_IRQHandler does not interrupt?

455 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jaybee on Wed Oct 24 02:23:14 MST 2012
Hi,

I am implementing a timeout function for my uart2 transmission. However, it did not work as I think it should..

In main.c I added this
void TIMER1_IRQHandler(void)
{
  RTC_timeMs++;                                //add the ms counter for fake RTCC
  TIM_ClearIntPending(LPC_TIM1, TIM_MR0_INT);
}


and in Uart.c I added this
char UART2_Getchar()
{
    timed_out = 0;
    long y;
    long delay;
    char cout;
    long time_delay;
    time_delay = 0;
    printf("ms while = %d\n", RTC_timeMs);
    time_delay = RTC_timeMs;
    while( ((LPC_UART2->LSR & LSR_RDR) == 0) && (RTC_timeMs < time_delay+25) )  // Nothing received so just block
    {
    }
    cout = LPC_UART2->RBR; // Read Receiver buffer register        //After 100msec if nothing receive = break() and error
    printf("ms while1 = %d\n", RTC_timeMs);
    return cout;
}


RTC_timeMs is a global variable that is included in all my files.

Somehow TIMER1_IRQHandler, stops interrupting while waiting for data at uart2 buffer. And it just hangs there....

With the exact same code, except this time for LPC_UART3, everything works as expected.


I need to use both Uart2 and Uart3 and someone point what did i do wrong here?
0 Kudos
3 Replies

366 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jaybee on Thu Oct 25 02:15:16 MST 2012
Thanks, you are so right.

It seems the interrupt for the usbcdc is preventing the timer1 interrupt to occur... Thanks.
0 Kudos

366 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by serge on Thu Oct 25 00:22:56 MST 2012
One of the things which can go wrong is interrupt priority.
Have you checked those?
Your code fragment is very incomplete to draw conclusions
0 Kudos

366 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gbm on Wed Oct 24 09:49:49 MST 2012
The code fragments you attach are incomplete. There might be many errors in your code. I guess the first one is the incorrect declartion of RTC_timeMs variable (volatile specifier is necessary here).
0 Kudos