stm32F4DISCOVERY串口通信问题

void RCC_Configuration(void)
{
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);

RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
}

void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Configure USART Tx and Rx as alternate function push-pull */
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
GPIO_Init(GPIOD, &GPIO_InitStructure);

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

GPIO_InitStructure.GPIO_Pin =GPIO_Pin_9;
GPIO_Init(GPIOD, &GPIO_InitStructure);

 GPIO_PinAFConfig(GPIOD,GPIO_PinSource8,GPIO_AF_USART3);

GPIO_PinAFConfig(GPIOD,GPIO_PinSource9,GPIO_AF_USART3);

}
void USART_Configuration(void)
{
USART_InitTypeDef USART_InitStructure;

USART_InitStructure.USART_BaudRate = 9600;  
USART_InitStructure.USART_WordLength =USART_WordLength_8b;  
USART_InitStructure.USART_StopBits = USART_StopBits_1;  
USART_InitStructure.USART_Parity = USART_Parity_No ;  
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;  
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;     
USART_Init(USART3,&USART_InitStructure); /* Configure USART1 basic and asynchronous paramters */  

    //USART_ITConfig(USART3,USART_IT_RXNE,ENABLE);
    USART_ITConfig(USART3,USART_IT_TXE,ENABLE);

USART_Cmd(USART3, ENABLE);   /* Enable USART1 */  

    USART_ClearITPendingBit(USART3,USART_IT_TC);

}

void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;//?????

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);   

NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);
}

int main(void)
{
RCC_Configuration();
GPIO_Configuration();
NVIC_Configuration();
USART_Configuration();

while(1);

}

volatile char StringLoop[] = "The quick brown fox jumps over the lazy dog";

void USART3_IRQHandler(void)
{
static int tx_index = 0;

// static int rx_index = 0;

if (USART_GetITStatus(USART3, USART_IT_TXE) != RESET) // Transmit the string in a loop

{

USART_ClearITPendingBit(USART3, USART_IT_TXE);
USART_SendData(USART3, StringLoop[tx_index++]);

if (tx_index >= (sizeof(StringLoop) - 1))  
  tx_index = 0;  

}
}

就是这个程序为什么会不停的发送数据,PC接收端一直在接收,不是清除了标志位吗,想问问大家啊

http://blog.csdn.net/metalseed/article/details/9845815