AnsweredAssumed Answered

ADuCM360:uart can't recieve data

Question asked by bomlulu on Nov 11, 2015
Latest reply on Dec 3, 2015 by ABuda

Hi,

When debug,the program can run normally,uart can transmit and recieve data.

when I download the same program to the board.uart can transmit data,but uart can't recieve data.

 

PROGRAM:

int main (void)
{
   WdtCfg(T3CON_PRE_DIV1,T3CON_IRQ_EN,T3CON_PD_DIS); 
   ClkDis(CLKDIS_DISSPI0CLK|CLKDIS_DISSPI1CLK|CLKDIS_DISI2CCLK|CLKDIS_DISPWMCLK|CLKDIS_DIST0CLK|CLKDIS_DIST1CLK|CLKDIS_DISDMACLK); // Only enable clock to used blocks
   ClkCfg(CLK_CD0,CLK_HF,CLKSYSDIV_DIV2EN_DIS,CLK_UCLKCG); 
   ClkSel(CLK_CD7,CLK_CD7,CLK_CD0,CLK_CD7);  
   UARTINIT();                    
   NVIC_EnableIRQ(UART_IRQn);         
   printf("/*ADUCM360*/\r\n");
   while (1)
   { 
       TEMP= GetChar();         
       printf("GET:%x\r\n",TEMP);
   }
}
void UARTINIT (void)                            
{   
   pADI_GP0->GPCON |= 0x3C;                       
   UrtCfg(pADI_UART,B9600,COMLCR_WLS_8BITS,0); 
   UrtIntCfg(pADI_UART,COMIEN_ETBEI|COMIEN_ERBFI); 
}
unsigned char GetChar (void)
{
    unsigned char temp; 
    while(!RxBufferFull);
    temp=UrtRx(pADI_UART);   
    RxBufferFull=0;
    return (temp);
   }
 int fputc(int ch, FILE *f)      
{      
      while(!TxBufferEmpty);
      UrtTx(pADI_UART,ch);
      TxBufferEmpty = 0;
      return (ch);   
}
void UART_Int_Handler ()                               
{
    volatile unsigned char UART_IntID = 0; 
    UART_IntID= UrtIntSta(pADI_UART);  
   if((UART_IntID & 0x02) == 0x02)     
   {
      TxBufferEmpty = 1;
   }
 if((UART_IntID & 0x4) == 0x4)    
   {
       RxBufferFull=1;
   }
}

Outcomes