AT91SAM7SE512: USART0 RXD interrupt

nanjooh wrote on Friday, October 19, 2007:

Dear All,

I am using the Keil uvision3 ARM version(Real view),
In my code  i  am using UART0 for Transmission and reception.

The transmission has no problem. For reception i am using the RX interrupt.
The problem is, If i type any letter in the keyboard (Hyperterminal),
no receiver interrupt  is generated in the controller.

Can you please help me to rectify this problem.

operating system: XP
Operating Tool :  Keil Uvision3 ARM view (version 3.53)
Controller:   AT91SAM7SE512
For your reference here is the code,

//*----------------------------------------------------------------------------
//* Function Name       : Usart_c_irq_handler
//* Object              : C handler interrupt function call by the interrupts
//*                       assembling routine
//*----------------------------------------------------------------------------
void Usart_c_irq_handler(void)
{
    AT91PS_USART USART_pt = AT91C_BASE_US0;
    unsigned int status;
    //* get Usart status register
    status = USART_pt->US_CSR;
    if ( status & AT91C_US_RXRDY){
        //* Get byte and send
        AT91F_US_PutChar (USART_pt, AT91F_US_GetChar(USART_pt));
    }

    if ( status & AT91C_US_OVRE) {
        //* clear US_RXRDY
         AT91F_US_GetChar(USART_pt);
         AT91F_US_PutChar (USART_pt, ‘O’);
    }

    //* Check error
    if ( status & AT91C_US_PARE) {
         AT91F_US_PutChar (USART_pt, ‘P’);
    }

    if ( status & AT91C_US_FRAME) {
         AT91F_US_PutChar (USART_pt, ‘F’);
    }

    if ( status & AT91C_US_TIMEOUT){
        USART_pt->US_CR = AT91C_US_STTTO;
         AT91F_US_PutChar (USART_pt, ‘T’);
    }

    // Reset the satus bit
     USART_pt->US_CR = AT91C_US_RSTSTA;
      
}
//*-------------------------- External Function -------------------------------

//*----------------------------------------------------------------------------
//* Function Name       : Usart_init
//* Object              : USART initialization
//*----------------------------------------------------------------------------
void Usart_init ( void )
//* Begin
{

    AT91PS_USART COM0 = AT91C_BASE_US0;

    //* Configure PIO controllers to periph mode
     AT91F_PIO_CfgPeriph( AT91C_BASE_PIOA,
         ((unsigned int) AT91C_PA5_RXD0    ) |
         ((unsigned int) AT91C_PA6_TXD0    ), 0); // Peripheral B
     //    ((unsigned int) AT91C_PA7_RTS0    ) |
     //    ((unsigned int) AT91C_PA8_CTS0    ), // Peripheral A
     //    0); // Peripheral B

    //* First, enable the clock of the USART
        AT91F_PMC_EnablePeriphClock ( AT91C_BASE_PMC, 1 << AT91C_ID_US0 ) ;
    //* Usart Configure
        AT91F_US_Configure (COM0, AT91B_MCK, AT91C_US_ASYNC_MODE, AT91_BAUD_RATE, 0);

    //* Enable usart
    COM0->US_CR = AT91C_US_RXEN | AT91C_US_TXEN;

    //* Enable USART IT error and RXRDY
        AT91F_US_EnableIt(COM0, AT91C_US_TIMEOUT |
                                AT91C_US_FRAME   |
                                AT91C_US_OVRE    |
                                AT91C_US_RXRDY);

    // open Usart 1 interrupt
    AT91F_AIC_ConfigureIt ( AT91C_BASE_AIC, AT91C_ID_US0, USART_INTERRUPT_LEVEL,AT91C_AIC_SRCTYPE_HIGH_LEVEL, Usart_c_irq_handler);
    AT91F_AIC_EnableIt (AT91C_BASE_AIC, AT91C_ID_US0);      

    AT91F_US_PutChar (COM0,‘X’);
             
     AT91F_US_SendFrame(COM0,(char *)display,sizeof(display),0,0);
     
        
       
//* End
}

with regards,
Murthy.R

hudson2009 wrote on Friday, October 19, 2007:

Do you have your interrupt service routine?

serialISR.c ?

void vUART_ISR( void ) __attribute__ ((naked));

void vUART_ISR( void )
{
  if( ulStatus & AT91C_US_RXRDY)
   {
    //—
   }
}