I have a problem with serial comunication under uCOS-II. My interrupt routine for RX byte on usart1 is continuosly called, but no byte are arriving on the port I checked it with an oscilloscope. When I really receive a byte I read it but the interrupt routine continue to be called and all the time I read the last real caracter I have received!!! I have made an empty project witout uCOS-II and all work fine. I use IAR 5.30
Code:
void BSP_INIT_USART1()
{
AT91C_BASE_AIC->AIC_IDCR = (1 << AT91C_ID_US1);
AT91C_BASE_AIC->AIC_ICCR = (1 << AT91C_ID_US1);
AT91C_BASE_PIOA->PIO_ASR = 0x00000360; // Peripheral A Select Register
AT91C_BASE_US1->US_CR = AT91C_US_RSTRX |
AT91C_US_RSTTX |
AT91C_US_RXDIS |
AT91C_US_TXDIS |
AT91C_US_RSTSTA ;
AT91C_BASE_US1->US_MR = AT91C_US_USMODE_NORMAL |
AT91C_US_CLKS_CLOCK |
AT91C_US_CHRL_8_BITS |
AT91C_US_PAR_NONE |
AT91C_US_NBSTOP_1_BIT ;
AT91C_BASE_US1->US_BRGR = 0x00000139; // 9600
AT91C_BASE_US1->US_RTOR = 0;
AT91C_BASE_US1->US_TTGR = 0;
AT91C_BASE_US1->US_FIDI = 0;
AT91C_BASE_US1->US_IF = 0;
AT91C_BASE_AIC->AIC_SVR[AT91C_ID_US1] = (unsigned long)XBEE_RX;
AT91C_BASE_AIC->AIC_SMR[AT91C_ID_US1] = AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | 4 ;
AT91C_BASE_US1->US_IDR = 0xFFFFFFFF;
AT91C_BASE_US1->US_IER = (1 << AT91C_US_RXRDY); // Interrupt on RX
AT91C_BASE_US1->US_CR = AT91C_US_RXEN |
AT91C_US_TXEN;
// Enable the clock of the PIO
AT91C_BASE_PMC->PMC_PCER = (1 << AT91C_ID_US1);
}
void BSP_ENABLE_USART1_INT()
{
AT91C_BASE_AIC->AIC_IECR = (1 << AT91C_ID_US1);
}
Best regards.