Serial Communication between 2 mega

Hi,

Boards: 2x Seeduino Mega
Baud: 4800

I am currently trying to communicate between two mega over Serial2 (HardwareSerial). Code is pretty basic. I am sending 2000 times 17 bytes as fast as the hardware let me call .

for(int i = 0 ; i < iu8_len ; i++)
	{		
		Serial2.print(iau8_array[i]);		
		i_sent++;
	}

On the other end it is a basic receive

// Serial is at 57600
// Serial2 is at 4800

if (Serial.available() > 0) {
		// read the incoming byte:
		incomingByte = Serial2.read();

		// say what you got:
		Serial.print("I received: ");
		Serial.println(incomingByte, DEC);
                u8_bytes_cnt++;
	}

However, I am always not getting the full 2000 * 17 bytes on the other end. Is it something I should expect at such a slow baud rate or I have other problem?

I am currently trying to communicate between two mega over Serial2 (HardwareSerial). Code is pretty basic. I am sending 2000 times 17 bytes.

In what period of tome? A week? A day? An hour? A second?

However, I am always not getting the full 2000 * 17 bytes on the other end. Is it something I should expect at such a slow baud rate or I have other problem?

The printing of the received data takes time. Depending on the speed that you print at, it could be causing the receive buffer to overflow, since more data is coming in than can be handled.

Try dropping the number of characters send out. Instead of "I received: ", use "In:"

Baud rate should have nothing to do with it as such.

I am always not getting the full 2000 * 17 bytes

How many are you getting?

What data are you sending and what are you receiving?

How fast is the Serial.print running? If it’s < about 15x (the length of “I received: nn”) the 4800 baud you may be overflowing the receive buffer.

You need to post both halves of the code.


Rob