Serial data when interrupts are disabled

If have a timing critical sketch, where i need to disable the interrupts sometimes to do timing critical stuff.

What happens with arriving serial data in this time? I think the arduino can't receive data when interrupts are disabled with cli(). So will the sender wait until serial can receive bytes again or are the packets lost? I'm using a leonardo with FTDI connected to pin 0 and 1.

I think the arduino can't receive data when interrupts are disabled

Correct.

So will the sender wait until serial can receive bytes again

The sender has no idea that the receiver is ignoring serial data.

or are the packets lost?

Yes.

I'm using a leonardo with FTDI connected to pin 0 and 1.

Makes no difference.

You will probably need to implement some sort of handshaking between the sender and the receiver, so the sender know when it is safe to send.

Keep in mind that serial data reception (and sending) is not the only thing impacted by disabling interrupts. The clock can't tick, either. That is, millis() doesn't increment.

Keep in mind that serial data reception (and sending) is not the only thing impacted by disabling interrupts. The clock can't tick, either. That is, millis() doesn't increment.

Thank you, good to know.

If have a timing critical sketch, where i need to disable the interrupts sometimes to do timing critical stuff.

What are you doing that's so time critical that you need to disable interrupts but still think you can use serial?

Mark

I'm driving a LED strip with 240 WS2811 LEDs and FastSPI_LED or WS2811.h. Both disables the interrupts while outputting the data to the LED strips. If any data is send through serial in this time, some packages are lost.

http://bleaklow.com/2012/12/02/driving_the_ws2811_at_800khz_with_a_16mhz_avr.html