I think, that the failure you are seeing is coming from : USART_ClearFlag(USARTx, USART_FLAG_RXNE); because The RXNE bit is automaticaly cleared when you read ''USART_DR'' register to get your previous character. ( refer to RM0008, section 24.6). so clearing it manually again in your checking routine we may loose some extra bytes. Could you please check and let me know ?. Cheers, ST1 :-?
I am getting two processors to communicate with each other without flow control. The communication I am getting seems to work, but there appears to be some strangeness with receive characters. About half of the time my incoming datastream is recognized as good (including CRC checks). The other half of the time the incoming characters are all shifted (as if the null character signals are not getting read). I don't know if this relates, but I'm getting assert failures every time I check my USART flags. I changed my assert routine so that it no long has a while loop in it and things seem to be okay (as detailed as above). Can anyone see why my assertions might fail? My code that is generating the failed assertion: u8 uart_check_for_char(void) { u8 Status; Status = USART_GetFlagStatus(USARTx, USART_FLAG_RXNE); USART_ClearFlag(USARTx, USART_FLAG_RXNE); return (Status); } Defines: #define USE_USART1 #ifdef USE_USART1 #define USARTx USART1 #define GPIOx GPIOA #define RCC_APB2Periph_GPIOx RCC_APB2Periph_GPIOA #define GPIO_RxPin GPIO_Pin_10 #define GPIO_TxPin GPIO_Pin_9 The assertion failure is being generated by the USARTx input, I believe.