About KL02Z UART Polling Method , Receive Error

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

About KL02Z UART Polling Method , Receive Error

ソリューションへジャンプ
1,192件の閲覧回数
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

ラベル(1)
1 解決策
1,116件の閲覧回数
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

元の投稿で解決策を見る

2 返答(返信)
1,117件の閲覧回数
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,116件の閲覧回数
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 件の賞賛