void Usart_init ( void )
{
COM0= AT91C_BASE_US1;
//* Define RXD and TXD as peripheral
// Configure PIO controllers to periph mode
AT91F_PIO_CfgPeriph(
AT91C_BASE_PIOA,
((unsigned int) AT91C_PA21_RXD1 ) |
((unsigned int) AT91C_PA22_TXD1 ) , // Peripheral A功能使能
0 ); // Peripheral B
//* First, enable the clock of the PIOB
AT91F_PMC_EnablePeriphClock ( AT91C_BASE_PMC, 1<
//* Usart Configure
AT91F_US_Configure (COM0, MCK,AT91C_US_ASYNC_MODE,USART_BAUD_RATE , 0);
//* Enable usart
COM0->US_CR = AT91C_US_RXEN | AT91C_US_TXEN;
//* open Usart interrupt
AT91F_AIC_ConfigureIt (AT91C_BASE_AIC, AT91C_ID_US1,
USART_INTERRUPT_LEVEL,
AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL,
Usart_c_irq_handler);
AT91F_AIC_EnableIt (AT91C_BASE_AIC, AT91C_ID_US1);
// Set the PDC
AT91F_PDC_Open (AT91C_BASE_PDC_US1);
COM0->US_RPR = (unsigned int) SciRxBuf;
COM0->US_RCR = 100;
first = 0;
COM0->US_RTOR = 0;//不检测超时
COM0->US_IER =AT91C_US_RXRDY ;//串口中断采用rxrdy中断
//* End
}
现在的问题是,初始化后,并不能进入串口中断程序 Usart_c_irq_handler(),而接受数组SCIRXBUF显示每次都收到了一个完整的数据包,比如串口发送400202bc,在串口中断程序中打了断点,并无法进去,但是每次scirxbuf都收到了400202bc这几个数据。后来我把rxrdy中断改为rxbuff中断,即将COM0->US_IER =AT91C_US_RXRDY ;改为COM0->US_IER =AT91C_US_RXBUFF ;却可以进入 Usart_c_irq_handler()中断程序。谁碰到过类似的情况啊?