Peter Geissen

Uart receive interrupt

Discussion created by Peter Geissen on Jul 14, 2011
Latest reply on Jul 22, 2011 by David Zawislak

I am trying to start a UART interupt if something is in the receive puffer. After the startup the Processor start his work. If i send something about the uart it jumps into a loop in the exceptions.h and the controller becomes very slow. Please could someone tell if their is any mistake in my code ?.

 

static unsigned char *fnSetIntHandler(int iVectNumber, unsigned char *new_handler){    extern unsigned long __VECTOR_RAM[];    unsigned char *old_handler;        old_handler = (unsigned char *)__VECTOR_RAM[iVectNumber];    __VECTOR_RAM[iVectNumber] = (unsigned long)new_handler;    return old_handler;     }/*            enable UART= interrupt      */void init_interrupt_controller(void) {  MCF_INTC0_ICR13 |= 0x24;        /* 111 111 => IL + IP */    MCF_INTC0_IMRL &= ~(MCF_INTC_IMRL_INT_MASK13 + MCF_INTC_IMRL_MASKALL);       /*(Interrupt level + Interrupt priority)*/ // fnSetIntHandler(UART0_VECTOR, (unsigned char *)_SCI0_Interrupt); // enter the handler routine   // MCF5XXX_SR |= (MCF5XXX_SR_IPL_5);        MCF_UART0_UIMR |= ( MCF_UART_UIMR_RXRDY_FU);       //MCF_UART_UIMR_TXRDY       // | MCF_UART_UIMR_RXRDY_FU          //| MCF_UART_UIMR_DB          //| MCF_UART_UIMR_COS);    }/*         enable interrupts in core's status register  */void enable_interrupts (void)  {  asm {          move.l   #0x00002000,d0          move.w   d0,SR      }    // Unmask appropriate bits in the core’s status register (SR) to enable interrupts  // refer to UM Interrupt Sources ch.15.3.6.1  } __declspec(interrupt:0) void handler_uart0_int (void){ LED_ON();     }

void main (void)
{
fnSetIntHandler(119,(unsigned char*)(*handler_uart0_int));
    init_interrupt_controller(); //Mask UART Interrupts
    enable_interrupts(); //enable interrupt in core's status register
}

 Regards

Outcomes