0

I'm trying to send data via UART from Due board to Nano board.

At first I try to send data from Nano to Due and it works.
But if I send the same data from Due to Nano it never receives it and my Serial1 is not available.

Here is the code sending data from Due to Nano which works.
Nano send data via Serial1 to Due.

void setup()
{
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop()
{
  delay(1000);
  Serial1.print('h');
  Serial.print('h');
}

Here Due receives the data.

char r;
void setup()
{
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop()
{
  if (Serial1.available() > 0)
  {
    Serial.println("Serial1");
    r=Serial1.read();
    Serial.println(r);
  }
}

And now I want to send data from Due to Nano so I just switch the code.

Due should be sending with Serial1 write or Serial1 print and the code for Due now looks like.

void setup()
{
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop()
{
  delay(1000);
  Serial1.print('h');
  Serial.print('h');
}

And nano should receive the data with serial read.

char r;
void setup()
{

  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop()
{
  if (Serial1.available() > 0)
  {
    Serial.println("Serial1");
    r=Serial1.read();
    Serial.println(r);
  }
}

But the Serial1 is not available.

Do someone know where the problem could be?

gre_gor
  • 6,669
  • 9
  • 47
  • 52
  • is it really Nano 33 BLE as you have in the title? what do you mean by "but the Serial1 is not available"? – Juraj Dec 22 '21 at 14:48
  • yes it's Nano 33 BLE and i can send data from it to DUE but not from DUE to Nano – Alaa Mousa Dec 22 '21 at 18:16
  • what do you mean by "but the Serial1 is not available"? it doesn't compile or Serial1.available() is always 0? – Juraj Dec 22 '21 at 18:24

0 Answers0