Question
STM32F4 Discovery, cannot clear parity error intterrupt
Posted on June 02, 2014 at 04:16
Hello,
I'm using STM32F4 discovery to develop usart communication function. The usart parameter is below./// Set serial port
USART_StructInit(&USART_InitStructure); USART_InitStructure.USART_BaudRate = 9600; ///< 9600bps USART_InitStructure.USART_WordLength = USART_WordLength_9b; ///< data 8bit + parity 1bit USART_InitStructure.USART_StopBits = USART_StopBits_1; ///< stop 1bit USART_InitStructure.USART_Parity = USART_Parity_Even; ///< parity even USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; ///< enable Rx, Tx USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; ///< no hardware flow control USART_Init(USART3, &USART_InitStructure); And enable PE interrupt, and then, send parity error data to this discovery board. So, parity error interrupt is occurred successfully, but after this parity error intterupt is occured continuously (I cannot clear the PE error bit). The USART intterrupt is below.void USART3_IRQHandler (void) __irq
{ char tmpRcv; /// PE Interrupt (PE flag is cleared when the flag is read) if (USART_GetFlagStatus(USART3, USART_FLAG_PE) == SET) { }/// RXNE interrupt
else if (USART_GetFlagStatus(USART3, USART_FLAG_RXNE) == SET) { ///receive data (and the RXNE flag is cleared) tmpRcv = USART_ReceiveData(USART3); ....}
It seems that the PE flag is not cleared when the flag is read. Please help to solve this problem. best regards. #uart #stm32 #discovery #usart