应该解决了这个问题,是由于CPU的UART_CR3中的OVRDIS没有打开,所以就一直在判断接收buf是否有数据溢出。
OVRDIS: Overrun Disable
This bit is used to disable the receive overrun detection.
0: Overrun Error Flag, ORE, is set when received data is not read before receiving new data.
1: Overrun functionality is disabled. If new data is received while the RXNE flag is still set
the ORE flag is not set and the new received data overwrites the previous content of the
USARTx_RDR register.
This bit can only be written when the USART is disabled (UE=0).
而且一定要在USART不打开的前提下关闭。仿真的时候把这个设置bit设置为1了,就可以继续断点执行了。