Problem with Uno's serial port


I have a problem with baud rates higher than 500kbps. I receive lots of errors (missing bytes or different values) from the genuine Arduino Uno's serial port (which uses the MEGA16u2). But with the clone Uno board (CH340) I receive no errors at all and I used the same code for both boards.

Anyone else experienced this problem? or Any suggestions?

Where do you see the errors? Application on the PC? Which one?

I think that your code can be important so we can see what your doing.

Take a look at this image:



I have a problem with baud rates higher than 500kbps.

It would help if you give some examples of the problem baud rates.


Thanks for the replies.
I’m receiving the Arduino’s serial data on a python program using pyserial for data logging.

Here is a test code that works just fine on the CH340 boards:

uint8_t data;

void setup() {
delay(1000); //the delay is here because pyserial takes a while to initialize

void loop() {

I also tried this identical code without the serial library, but I got the same results:

uint8_t tx;

void setup() {
UBRR0 = 0; //1mbps
UCSR0C |= (1 << UCSZ01) | (1 << UCSZ00); //8 bit frames
UCSR0B |= (1 << RXEN0) | (1 << TXEN0); //rx, tx enable

void loop() {

void USART_Transmit( unsigned char data ) {
while ( !( UCSR0A & (1 << UDRE0)) );
UDR0 = data;

I attached the python program I was using for testing. It simply prints the received values to the terminal. If no one else is having this type of problem maybe I should reflash the Mega16u2.

Serial (860 Bytes)

I attached the python program I was using for testing.

Please just post it as a .txt file. I’m not going to download a strange ZIP file.

If it is a short program please include it in your Post using the code button </>

so your code 
looks like this


import serial

decode = [b'\x00', b'\x01', b'\x02', b'\x03', b'\x04', b'\x05', b'\x06', b'\x07', b'\x08', b'\t', b'\n', b'\x0b', b'\x0c', b'\r', b'\x0e', b'\x0f', b'\x10', b'\x11', b'\x12', b'\x13', b'\x14', b'\x15', b'\x16', b'\x17', b'\x18', b'\x19', b'\x1a', b'\x1b', b'\x1c', b'\x1d', b'\x1e', b'\x1f', b' ', b'!', b'"', b'#', b'

, b’%’, b’&’, b"’", b’(’, b’)’, b’*’, b’+’, b’,’, b’-’, b’.’, b’/’, b’0’, b’1’, b’2’, b’3’, b’4’, b’5’, b’6’, b’7’, b’8’, b’9’, b’:’, b’;’, b’<’, b’=’, b’>’, b’?’, b’@’, b’A’, b’B’, b’C’, b’D’, b’E’, b’F’, b’G’, b’H’, b’I’, b’J’, b’K’, b’L’, b’M’, b’N’, b’O’, b’P’, b’Q’, b’R’, b’S’, b’T’, b’U’, b’V’, b’W’, b’X’, b’Y’, b’Z’, b’[’, b’\’, b’]’, b’^’, b’_’, b’`’, b’a’, b’b’, b’c’, b’d’, b’e’, b’f’, b’g’, b’h’, b’i’, b’j’, b’k’, b’l’, b’m’, b’n’, b’o’, b’p’, b’q’, b’r’, b’s’, b’t’, b’u’, b’v’, b’w’, b’x’, b’y’, b’z’, b’{’, b’|’, b’}’, b’~’, b’\x7f’, b’\x80’, b’\x81’, b’\x82’, b’\x83’, b’\x84’, b’\x85’, b’\x86’, b’\x87’, b’\x88’, b’\x89’, b’\x8a’, b’\x8b’, b’\x8c’, b’\x8d’, b’\x8e’, b’\x8f’, b’\x90’, b’\x91’, b’\x92’, b’\x93’, b’\x94’, b’\x95’, b’\x96’, b’\x97’, b’\x98’, b’\x99’, b’\x9a’, b’\x9b’, b’\x9c’, b’\x9d’, b’\x9e’, b’\x9f’, b’\xa0’, b’\xa1’, b’\xa2’, b’\xa3’, b’\xa4’, b’\xa5’, b’\xa6’, b’\xa7’, b’\xa8’, b’\xa9’, b’\xaa’, b’\xab’, b’\xac’, b’\xad’, b’\xae’, b’\xaf’, b’\xb0’, b’\xb1’, b’\xb2’, b’\xb3’, b’\xb4’, b’\xb5’, b’\xb6’, b’\xb7’, b’\xb8’, b’\xb9’, b’\xba’, b’\xbb’, b’\xbc’, b’\xbd’, b’\xbe’, b’\xbf’, b’\xc0’, b’\xc1’, b’\xc2’, b’\xc3’, b’\xc4’, b’\xc5’, b’\xc6’, b’\xc7’, b’\xc8’, b’\xc9’, b’\xca’, b’\xcb’, b’\xcc’, b’\xcd’, b’\xce’, b’\xcf’, b’\xd0’, b’\xd1’, b’\xd2’, b’\xd3’, b’\xd4’, b’\xd5’, b’\xd6’, b’\xd7’, b’\xd8’, b’\xd9’, b’\xda’, b’\xdb’, b’\xdc’, b’\xdd’, b’\xde’, b’\xdf’, b’\xe0’, b’\xe1’, b’\xe2’, b’\xe3’, b’\xe4’, b’\xe5’, b’\xe6’, b’\xe7’, b’\xe8’, b’\xe9’, b’\xea’, b’\xeb’, b’\xec’, b’\xed’, b’\xee’, b’\xef’, b’\xf0’, b’\xf1’, b’\xf2’, b’\xf3’, b’\xf4’, b’\xf5’, b’\xf6’, b’\xf7’, b’\xf8’, b’\xf9’, b’\xfa’, b’\xfb’, b’\xfc’, b’\xfd’, b’\xfe’, b’\xff’]

i = 0
x = 0

ser = serial.Serial(‘COM13’, 1000000)

while x < 1000: #limit of 1000 values otherwise the terminal crashes
    data =
    if data:
        while i < 256:
            if data == decode[i]:
        i = 0

If it works at 1,000,000 baud with one Arduino and not with the other it does suggest that there is some difference between the boards.

It would be interesting to try on a different PC in case the problem is simply a slight timing incompatibility. While 1,000,000 is a natural speed for an Atmega 328 due to its 16MHz clock speed I don't know if it is a natural speed for a PC.