Arduino_core_stm32: How to use Serial2

Created on 22 Mar 2019  路  2Comments  路  Source: stm32duino/Arduino_Core_STM32

I found this section on your boards.txt.

# NUCLEO_F103RB board
# Support: Serial1 (USART1 on PA10, PA9) and Serial2 (USART3 on PC11, PC10)

I tried Serial2.
But Serial2.println() output to Arduino-IDE Monitor.
I want to output like this.
To Arduino-IDE using Serial.
To PC10 using Serial2.

Code:

void setup() {

  Serial.begin(115200);
  Serial2.begin(115200);
  Serial.println("setup() start");
  Serial2.println("Serial2 setup() start");

  while (1) {
    Serial.println("setup alive...");
    Serial2.println("Serial2 setup alive...");
    delay(1000);
  }
}

void loop() {
  // Not used.
}

My setting:
Serial2

Result:
Serial2-2

Bug Documentation

Most helpful comment

Serial1 seems to work right.
I confirm that Serial1.println() output to PA9.

My code:

HardwareSerial Serial1(PA10, PA9);

void setup() {

  Serial.begin(115200);
  Serial1.begin(115200);
  Serial.println("setup() start");
  Serial1.println("Serial1 setup() start");

  while (1) {
    Serial.println("setup alive...");
    Serial1.println("Serial1 setup alive...");
    delay(1000);
  }
}

void loop() {
  // Not used.
}

Thank you.

All 2 comments

Serial1 seems to work right.
I confirm that Serial1.println() output to PA9.

My code:

HardwareSerial Serial1(PA10, PA9);

void setup() {

  Serial.begin(115200);
  Serial1.begin(115200);
  Serial.println("setup() start");
  Serial1.println("Serial1 setup() start");

  while (1) {
    Serial.println("setup alive...");
    Serial1.println("Serial1 setup alive...");
    delay(1000);
  }
}

void loop() {
  // Not used.
}

Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Pararera picture Pararera  路  5Comments

SuperBoss9 picture SuperBoss9  路  6Comments

Jorgen-VikingGod picture Jorgen-VikingGod  路  8Comments

kwastek picture kwastek  路  4Comments

romainreignier picture romainreignier  路  7Comments