About KL02Z UART Polling Method , Receive Error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

About KL02Z UART Polling Method , Receive Error

Jump to solution
1,182 Views
ellenlin
Contributor III

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

Labels (1)
1 Solution
1,106 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Lin,

I run your code on my FRDM-KL02. It works fine. Would you please check hardware again?

Regards,

Jing

View solution in original post

2 Replies
1,107 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Lin,

I run your code on my FRDM-KL02. It works fine. Would you please check hardware again?

Regards,

Jing

1,106 Views
ellenlin
Contributor III

Dear Jing Pan &#21729;&#24037; , 

   Thanks for your help , i has already check HW , my connector has some damage so doesn't receive any data , thanks a lot !!

0 Kudos