Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: uCOS-II and USART1 on SAM7X256
PostPosted: Sun Apr 19, 2009 11:27 pm 
Offline

Joined: Thu Mar 26, 2009 11:46 am
Posts: 10
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.


Top
 Profile  
 
 Post subject: Re: uCOS-II and USART1 on SAM7X256
PostPosted: Thu Apr 23, 2009 3:35 pm 
Offline

Joined: Thu Mar 26, 2009 11:46 am
Posts: 10
Solved, the error was


AT91C_BASE_US1->US_IDR = 0xFFFFFFFF;
AT91C_BASE_US1->US_IER = (1 << AT91C_US_RXRDY); // Interrupt on RX

because

AT91C_US_RXRDY = (1 << 0)

so

1 << (1 << 0)

thath is TX and NOT RX


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron