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.
This commit is contained in:
Petr Ledvina 2014-11-11 12:38:57 +01:00
parent 98c0d0b5dd
commit 3b20b74c00
1 changed files with 1 additions and 1 deletions

View File

@ -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++;
}