Lost Bytes when reading Serial1 when receiving also data via native USB port

Erros on Transmissions are really hard to happen (not impossible).
Erros on receiving are even more likely to happen (they occur lots of time). That's the reason why a good protocol with CRC and others "packet checking system" are more reliable.

With what I have worked, erros that are most commonly:

  • Output Buffer overflow. When sending, if the amount of bytes sent to the hardware exceed it's size, it's cropped (that's not YOUR case, but pay attention to it). Usually, you have to wait it to send things to continue flling the buffer.

  • Input Buffer Overflow. When receiving, if the ammount of incomming data exceeds the input buffer size, you will have lost bytes and/or wrong byte data. In this case, ALWAYS reading the buffer resolves it, but, keep in mind that: Buffers overflows VERY fast! In the ATMEGA328 it's about 64bytes only! (Due is more, but not infinite).

  • Errors on triggering/receipment. If you are dealing with lot's of concurrent operations (not "parallel" but things like interruptions or such things), this can slow make the hardware to crash while reading something (VERY hard to happen).

  • Physical Errors. Data transmission problems... (Most common in my case, since electronics are really suseptible to noises and things that causes the message to receive with problem or, not receive.

In sum: If you want a ROBUST system, use/create a protocol that has a CRC system, to check if the content of the transmission is really correct...