AnsweredAssumed Answered

About KL02Z UART Polling Method , Receive Error

Question asked by e Lin on Mar 21, 2019
Latest reply on Mar 26, 2019 by e Lin

Dear NXP , 

 

   I use KL02Z try to make a project with UART ( Polling method ) , IDE is code warrior 11.0 . Baud Rate is almost 9600

 

   UART Sending data is normal . But Receive Data won't work , has already check PC UART Tool and waveform are normal .

 

   Attachment is my code , could you help to point out what is wrong with this code ? thanks a lot !!

 

   void UART_INIT(void)
{
UART0_C2 &= ~(UART0_C2_TE_MASK | UART0_C2_RE_MASK);
UART0_BDH = 0x01 ;
UART0_BDL = 0x38 ;
UART0_C4 = 0x0F ;
UART0_C1 = 0x00 ;
UART0_C3 = 0x00 ;
UART0_MA1 = 0x00 ;
UART0_S1 |= 0x1F ;
UART0_S2 |= 0xC0 ;
UART0_C2 |= UART0_C2_TE_MASK | UART0_C2_RE_MASK ;
}

 

while(1)
{
while(!(UART0_S1&UART0_S1_RDRF_MASK));     <------------ always wait here 
String = UART0_D;
while(!(UART0_S1&UART0_S1_TDRE_MASK)&&!(UART0_S1&UART0_S1_TC_MASK));
UART0_D = String ;
}

 

B.R

Ellen Lin

Attachments

Outcomes