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
@@ -43,14 +43,21 @@ static const stm32_softserial_rx_port* _softserialPort;
static void _softserial_exti()
{
if (rxBitCount == 0) {
auto port = _softserialPort;
// cheap debouncing...
for (uint8_t i = 0; i < 16; ++i) {
if (LL_GPIO_IsInputPinSet(port->GPIOx, port->GPIO_Pin) == 0)
return;
}
// enable timer counter
auto TIMx = _softserialPort->TIMx;
auto TIMx = port->TIMx;
LL_TIM_SetAutoReload(TIMx, (BITLEN + BITLEN/2) - 1);
LL_TIM_EnableCounter(TIMx);
// disable start bit interrupt
LL_EXTI_DisableIT_0_31(_softserialPort->EXTI_Line);
LL_EXTI_DisableIT_0_31(port->EXTI_Line);
}
}