fix: Various mostly X10E soft serial issues (#3382)

* fix: pulse driver with 32bit timers

* fix(mpm): clear RX buffer before signature

* fix: add some debouncing on soft-serial start bit detection

This helps coping with spurious impulses on S.PORT created by payload sent over PPM pin (X10E).

* fix: whenever the RXNE bit is set, read the register

... regardless of errors. That allows for reducing the effect of detected errors.
This commit is contained in:
Raphael Coeffic
2023-03-26 11:23:32 +10:00
committed by GitHub
parent 8560c1f6bf
commit e016598b56
4 changed files with 21 additions and 7 deletions
@@ -557,14 +557,15 @@ void stm32_usart_isr(const stm32_usart_t* usart, etx_serial_callbacks_t* cb)
// Drain RX
while (status & (LL_USART_SR_RXNE | USART_FLAG_ERRORS)) {
// This will clear the RXNE bit in USART_DR register
uint8_t data = LL_USART_ReadReg(usart->USARTx, DR);
if (status & USART_FLAG_ERRORS) {
if (cb->on_error)
cb->on_error();
}
else {
if (status & LL_USART_SR_RXNE) {
// This will clear the RXNE bit in USART_DR register
uint8_t data = LL_USART_ReadReg(usart->USARTx, DR);
if (cb->on_receive)
cb->on_receive(data);
}