From 3b20b74c0017fbc210a3091bf7ff4fbe42abfdf7 Mon Sep 17 00:00:00 2001 From: Petr Ledvina Date: Tue, 11 Nov 2014 12:38:57 +0100 Subject: [PATCH] Fixed original softserial code Bit end timer must by shifted by half-bit period to startbit edge, so that next edges are in middle of bit interval. This behavior was masked with old timer code, but noise immunity was probably very low. --- src/main/drivers/serial_softserial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/drivers/serial_softserial.c b/src/main/drivers/serial_softserial.c index c5cef7434..82a0eb468 100644 --- a/src/main/drivers/serial_softserial.c +++ b/src/main/drivers/serial_softserial.c @@ -337,7 +337,7 @@ void onSerialRxPinChange(timerCCHandlerRec_t *cbRec, captureCompare_t capture) // synchronise bit counter // FIXME this reduces functionality somewhat as receiving breaks concurrent transmission on all ports because // the next callback to the onSerialTimer will happen too early causing transmission errors. - TIM_SetCounter(softSerial->rxTimerHardware->tim, 0); + TIM_SetCounter(softSerial->rxTimerHardware->tim, softSerial->rxTimerHardware->tim->ARR / 2); if (softSerial->isTransmittingData) { softSerial->transmissionErrors++; } -- 2.11.4.GIT