Community
cancel
Showing results for 
Search instead for 
Did you mean: 
FSpan
Novice
1,341 Views

Serial communication between two Intel Galileo Gen 2

Hi,

I'm new in using Intel Galileo, and I'm trying to connect two Intel Galileo Gen 2 in order to communicate each other.

I've linked pin 0 (rx) of board "A" with pin 1 (tx) of board "B" and viceversa. I've also connected the two ground together.

On the board "A" I've loaded this sketch:

byte b = 0x00;

void setup() {

Serial.begin(115200);

}

void loop()

{

Serial.write(b);

}

On the board "B" I've loaded this one:

byte num;

void setup() {

Serial.begin(115200);

}

void loop() {

if(Serial.available()>0) {

num = Serial.read();

}

Serial.println(num);

}

Obviously, board "B" doesn't receive anything. But why?

Please, help me.

8 Replies
Diego_V_Intel
Employee
112 Views

Hi FabioCRS4,

In order to send/receive data through the pins 0 and 1 you should use Serial1 instead of Serial.

Regards,

Diego

FSpan
Novice
112 Views

Hi DiegoV_Intel,

firstly thank you for your answer.

Also using Serial1 instead of Serial, it doesn't work.

FTinetti
Honored Contributor I
112 Views

Where do you expect the B's Serial.println(num) to be?

Fernando.

FSpan
Novice
112 Views

In theory, I think the number should be printed on the serial monitor, but I'm not very sure.

FTinetti
Honored Contributor I
112 Views

FabioCRS4 wrote:

In theory, I think the number should be printed on the serial monitor, but I'm not very sure.

Well, if B's serial port is used for communication with Galileo A, then I think there might be at least a problem. Even assuming physical connection is shared without trouble (both A and the PC having the serial monitor would be connected to B's serial port) I don't know what would happen with the (physical) signals and (logical) characters received at A's serial port, which are generated by Serial.println(num). I don't know how the DiegoV_Intel suggestion would work either.

Fernando.

FTinetti
Honored Contributor I
112 Views

Replying to myself just to point out that may be of some help, due to the description of pins/ports.

HTH,

Fernando.

Diego_V_Intel
Employee
112 Views

Hi FabioCRS4,

The data is sent to the Serial Monitor through Serial, while Serial1 sends data to the pins 0 and 1. So, you should add Serial1 to send and receive data between the boards, and use Serial to display the data in the Serial Monitor.

In the sketch of the board "A" you only have to change Serial to Serial1. With this change the data would be sent through the pin 1.

In the sketch of the board "B" you have to add the initialization of Serial1 using the .begin() method, and change Serial.available() and Serial.read() to use Serial1 instead. The last line that prints the variable "num" is fine because you would be printing the data received in the Serial Monitor of the board "B".

Regards,

Diego

FSpan
Novice
112 Views

Thank you very much Diego, now it works!

Regards,

Fabio

Reply