AnsweredAssumed Answered

Problem with interrupt buffer index increment

Question asked by roy@mai on Aug 10, 2010
Latest reply on Aug 11, 2010 by gyi

I have a problem where I can see my receiver buffer get new stuff with rrx_buff[rrx_cnt++]=*pUART0_RBR;
while I could not retrieve rrx_cnt correctly.
 
Could somebody helps me ? thanks a lot. The codes follows:
 
// UART receive interrupt service routine

// EX_INTERRUPT_HANDLER(uarto_rx_ISR){}

 

volatile unsigned char rrx_buff[BUFFER_SIZE];
volatile unsigned int rrx_cnt;
 
void uart0_rx_ISR() {
 
      *pDMA8_IRQ_STATUS |= DMA_DONE;            //clear the interrupt
 
       while (!(*pUART0_LSR & DR)) { /* wait */}
      
      if(rrx_cnt<BUFFER_SIZE-1){
          rrx_cnt++;
          rrx_buff[rrx_cnt]= *pUART0_RBR; 
  //here I can see rrx_buff gets the input from the serial port correctly and 
// updated accordingly, but rrx_cnt=0 (which I initialized it, and does not change at all)
      }
      else{
        rrx_cnt=1;
      }
      
      SSYNC;
}

Outcomes