Chat here about code rewrites, mods, etc... with respect to the github project https://github.com/esp8266/Arduino

Moderator: igrr

User avatar
By mvdbro
#58018 Considering to add softwareserial to my project, but after reading some issues about this library, specifically this one:

https://github.com/esp8266/Arduino/issues/1426

where "igrr commented on 11 Feb":
Note that you should never disable interrupts for periods longer than 20 microseconds (that's what SDK release notes said).

I started to get some serious doubts. If the statement is correct and i do some simple math:

Suppose we use 9600 BAUD software serial
Using 9600 baud, 1 bit takes 104 uSec.
One byte equals to 10 bits, so one byte takes 1040 uSec

the transmit code has this:

cli();
send one byte of data, so takes 1040 uSecs...
sei();

so it disables interrupts for more than 1040 uSec. Far beyond the 20 uSec!

And the RX routine is an ISR routine that also waits for an entire byte to be received.
effectively blocking other interrupts.

So is it wise to include this into stable projects? The issue on github is still open, no milestone...