Closed ulde closed 6 years ago
Hi Ulde, Thanks for your contribution. Your modification makes sense to me. Have tested it enough to notice an actual improvement in the reliability? Cheers, Adriano.
Yes. Actually I made the chance because I was unable to receive with soft_uart from a serial line coming from a micro controller. The oscilloscope showed that the MCU occasionally had a tiny delay driving the line transition to the next bit. Even a few microseconds off, even at very low bps rates, are enough to corrupt the data. This change addresses this kind of situations.
Best, Ulde
The RX GPIO was polled exactly at the transition time from one bit to the next. If the transmitting device presents some jitter or is simply a bit late driving its TX line, soft_uart could fail to detect the correct value on bit level transitions. This change simply starts the polling timer not immediately on the start bit interrupt, but a half bit period later, so that all RX GPIO level polling now occurs at the center of each bit, making the RX side of soft_uart more robust.