1. stm8l Serial port interrupt attention point
When debugging the PM2.5 sensor gp2y1051, it is found that the data can be accepted at the time of the simulation, but if the data is not accepted after the pause, it is just a complete data reception.
Problem procedure
Workaround
if ( usart_getitstatus ( usart1 Usart_it_rxne
{
receviedata = Usart_receivedata8 ( usart1
switch ( state_machine )
2. stm8s Serial port interrupt attention point
Levy on STM8S003F3 or 103 series, such as single-chip microcomputer, because the other single-chip computer is different, the serial receiver interrupt has ore, that is, overload error, receive interrupts;:
Therefore, we need to do the following processing in the serial receiver interrupt:
if(UART2->SR & UART2_SR_OR)
{
UART2->SR &= ~UART2_SR_OR;
UART2->SR &= ~UART2_SR_RXNE;
u8RevDat=UART2_ReceiveData8();
}
else
u8RevDat=UART2_ReceiveData8();
RecevieData = u8RevDat;
From for notes (Wiz)
Stm8s and stm8l debugging serial port interrupt attention point