I use the Serial wizard to send the data no problem, but the receiving data did not respond.
Serial port to accept the time must be interrupted, you send only by a single flag bit can be judged, but the acceptance of time, you are always stay in while inside, we judge whether to accept the completion, by detecting whether to receive 0x0d, 0x0a continuous to detect whether the end. When this end sequence is detected, the highest bit of the usart_rx_sta is placed to mark the data that has been searched. Then wait for the external function to clear before accepting it for the second time.
Modified: HyperTerminal send settings to wrap as Send end, OK
while (1) {if (usart_rx_sta&0x8000) { len=usart_rx_sta&0x3fff;//μ?μ?′?′?? Óê?μ?μ?êy? y3¤?èprintf ("\r\n?ú ¢?íμ???? ¢?a:\r\n "); for (t=0;t<len;t++) {usart_senddata (USART1, usart_rx_buf[t]); ? ò′®?ú1 ¢?íêy? Ywhile (Usart_getflagstatus (USART1,USART_FLAG_TC)!=set);//μè′y ¢?í?áê?} printf ("\r\n\r\n");//2?è??? ddusart_rx_sta=0;} Else{times++;if (times%5000==0) {printf ("\r\nalientekì?? ÷?? Stm32f407?a ¢°? ′®?úêμ?é\r\n ");p rintf ("? yμ?? -xó@alientek\r\n\r\n\r\n ");} if (times%200==0) printf ("?? Ê?è?êy? Y,ò??? 3μ?ü?áê?\r\n "); if (times%30==0) led0=! Led0;//éá?? Led,ìáê?? Μí3?y?ú?? Dd.delay_ms (ten); }}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
STM32F4 the data sent by HyperTerminal is not received in the serial experiment, but the debug tool can