Closed SRGDamia1 closed 6 years ago
I made a comment in this pull request about rxWindowWidth
. It is a fudge factor that makes it work...
However, I don't think 57600 can work, because the number of ticks per bit is too small at 250KHz (the TIMER0 frequency) on 16MHz. Slight variations in the dispatch time make it difficult to distinguish between 1 bit time and 2 bit times.
If you can make it work for an "unloaded" system, one where there are a limited number of interrupts that can be simultaneously pending, great. I suspect you might be having trouble because the millis
interrupt and another serial interrupt are delaying the Pin Change Interrupt dispatch. This leads to the uncertainty in a 4us tick.
I would consider a configuration item that enables using a different timer at a higher frequency. With increased resolution, you might be able to support 57600. Like I mentioned elsewhere, when you get to these speeds, it's better to use AltSoftSerial
, because it knows exactly when the bit changed.
And this feature needs to be a configuration item, because an advantage of NeoSWSerial
is that it does not require any additional resources (e.g., a timer). All other libraries do.
Thanks for the contributions!
I think I have the calculation for bits/tick and ticks/bit*multiplier correct, but I'm not getting 57600 to work on either a 32u4 or 1284p board. I'm not sure if it has something to do with the "WindowWidth" or if there's something else I'm totally missing. If you have time, I'd love some help.