My project today requires a timer ISR updating pixels, use of millis() for timing/scheduling purposes, and reception of Serial strings (short, but several characters) at 115200 baud.
For an Arduino Nano running at the usual 16 MHz, about how long will the millis interrupt take? (My suspicion is, < 5 us, the function it performs is pretty trivial). And, how long will it take for a character to be received and queued by Serial? (My suspicion is, < 10 us, or setting baud to 1000000 wouldn't work reliably),
Any answers would be appreciated; what I'm looking for, though, are answers like "18 us, give or take, depending on the path through the ISR". Even "your suspicions are conservative" would be adequate.
The reason is, I may have to enable, then disable, interrupts within a timer interrupt response; it's got to have a 1.3 ms 'block' of code that executes to completion, to feed data to 32 WS2812 pixels. Right now, we do that all within one interrupt response, but it means we cannot receive Serial at anything better than 4800, due to overruns of the UART. While that baud is acceptable, I'm exploring alternatives, because extending the number of pixels further naturally reduces the usable baud further.
If the answers to my questions are small enough, I could break the 1.3 ms up by sending each pixel's data with an enable/disable interrupts action between each one, I just have to avoid breaks long enough to trigger the 'reset' state in the pixels(> 200 us, as I read the datasheet).
I think this will work, though if someone sees a fundamental 'oops', such as "you may not vary the clock rate of the data to the WS2812 in that manner", please speak up.
TIA