This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

not able to Read U0RBR in UART0 interrupt(LPC2388)

Hi

Not able to Read U0RBR in UART0 interrupt(for receive - RDA interrupt ). My UART0 interrupt is working (i have put the Break point) but the U0RBR register showing always Zero value. In polling method i am able read the values from U0RBR register so no issues in communication. UART0 initialization code and UART0 Interrupt code mentioned below. Please help me regarding the same.

thanks
Goran

/*============================================================================
 Function: Serial_UART3_Init(void)
 =============================================================================
        Function  description   :       Intilizes UART 3
        Prototype                               :       void Serial_UART3_Init(void)
        Parameter                               :   None
        Return                                  :       None


         Baud rate calculation  :
                                                                        PCLK
        UART3 Baudrate =        ----------------------------------------------------------
                                         (16 x ((256 x U3DLM)+ U3DLL) x (1 + (DivAddVa / MulVal))

                                         pclk = 12MHz
                                         U3DLM = 0
                                         U3DLL = 71;
                                         DivAddVa = 1
                                         MulVal = 10

         UART3 Baudrate   = 9603        ; which is near to 9600 Baud rate.
         This gives U3DLL = 71
                                U3FDR = 0xA1  */

void Serial_UART0_Init(void)
{
        PINSEL0=0x00000050;     // Configure P0.2 as TXD0 and P0.3 as RXD0; pull-up resistor enabled
    U0LCR = 0x83;           // 8 bits, no Parity, 1 Stop bit ,Enable access to Divisor Latches.
        U0DLL = 71;             // 9603 Baud Rate @ 12MHz PCLK Clock
        U0FDR = 0xA1;           // Fractional Divider
        U0LCR = 0x03;           // DLAB = 0
        U0IER = 0x01;           // Enable RDA interrupt

}
/*============================================================================
  ============================================================================*/


/*============================================================================
 Function: Interrupt_Init(void)
 =============================================================================*/
void Interrupt_Init(void)
{

   VICVectAddr4 = (unsigned long) TIMER0_IRQHandler;  /* set interrupt vector 4 */
   VICVectPriority4 = 15 ;                             /* default priority is 15  */
   VICIntEnable |= ((unsigned long)1<<4);              /* Enable TIMER0 Interrupt */

   VICVectAddr6 = (unsigned long) UART0_IRQHandler;    /* set interrupt vector 6 */
   VICVectPriority6 = 15 ;                             /* default priority is 15  */
   VICIntEnable |= ((unsigned long)1<<6);              /* Enable UART0 Interrupt */

}
/*============================================================================
  ============================================================================*/


/*===========================================================================*
 *ISR: UART0 :serial receive and transmit interrupt                                                      *
 *===========================================================================*/

__irq void UART0_IRQHandler(void)
{

                RX_BUF[rx_count] = (char)U0RBR;

                if ((U0IIR & 0x0E) == 0x04)
        {
                         if(rx_count == 0)
                        {
                                RX_BUF[rx_count] = (char)U0RBR;

                                if(RX_BUF[0]== Slave_Address)
                                        {
                                        rx_count++;


                                }
                                else
                                        rx_count = 0;
                }
                else
                        {
                                RX_BUF[rx_count++] =  U0RBR;
                }
                if(rx_count >= 8)
                {
                        rx_count = 0;

                if( (RX_BUF[0]== Slave_Address) && ((RX_BUF[1]==Function_Code)||(RX_BUF[2]==AddressFunCode_LOWBYTE)))
                                rx_flag = 1;

                }

        }           /* Receive Mode end */

  uart0_flag = 1;
  VICVectAddr = 0;                    /* Acknowledge Interrupt               */
}


0