Hi ksamay,
1Mbps / 10 bits/char = 100000 chars/s
16 MHz / 100000 chars/s = 160 CPU cycles per character
receiving at 1 MBps requires a very tight timing and even disabling IRQs for a very short time (1 character = 160 CPU cycles) is enough for the serial receive ISR to lose data.
This means:
- avoid to disable IRQs whenever possible
- if you have to disable IRQs, keep the the time as short as possible
- the same as #1 for other ISRs, e.g. the timer IRQ used for millis()/micros()
The timer ISR is called every 1024 microseconds and it might take more than 160 CPU cycles. When you don't need the time functions, you can disable the timer ISR:
cbi(TIMSK0, TOIE0);
Please try if this fixes your problem.
MikeT