[SOLVED]can't access Serial2 in STM32F103C8T6

Post here first, or if you can't find a relevant section!
Post Reply
fathan95
Posts: 6
Joined: Mon Aug 21, 2023 9:16 am
Answers: 1

[SOLVED]can't access Serial2 in STM32F103C8T6

Post by fathan95 »

hi, I'm new to STM32duino. Yesterday I try to access Serial2 in STM32F103C8T6 and fail. I only can access Serial1 in PA9 and PA10. anyone can help? Here is my code

Code: Select all

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial2.begin(9600);
  Serial3.begin(9600);
    
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println ("Serial : hello");
  Serial2.println("Serial1: world");
  Serial3.println("Serial2: Hello world");
  delay(1000);
}
by fathan95 » Tue Aug 22, 2023 1:44 am
I using core from rogerclarkmelborne before, and I try another core in this link
https://github.com/stm32duino/Arduino_Core_STM32

And after that i found article about HardwareSerial in this link
https://github.com/stm32duino/Arduino_C ... 2/wiki/API


This is my code

Code: Select all

HardwareSerial Serial2(PA3,PA2);
HardwareSerial Serial3(PB11,PB10);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial2.begin(9600);
  Serial3.begin(9600);
    
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println ("Serial : HELL000");
  Serial2.println("Serial2: Hell");
  Serial3.println("Serial3: Lo !");
  delay(1000);
}
And it's done! Thank you for your help! :D
Go to full post
Last edited by fathan95 on Tue Aug 22, 2023 1:48 am, edited 2 times in total.
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: can't access Serial2 in STM32F103C8T6

Post by ag123 »

you should mention the core that you are using
viewforum.php?f=2
there are some differences between them, and check that you are using the correct pins
https://os.mbed.com/users/hudakz/code/S ... 8T6_Hello/
fathan95
Posts: 6
Joined: Mon Aug 21, 2023 9:16 am
Answers: 1

Re: can't access Serial2 in STM32F103C8T6

Post by fathan95 »

I using core from rogerclarkmelborne before, and I try another core in this link
https://github.com/stm32duino/Arduino_Core_STM32

And after that i found article about HardwareSerial in this link
https://github.com/stm32duino/Arduino_C ... 2/wiki/API


This is my code

Code: Select all

HardwareSerial Serial2(PA3,PA2);
HardwareSerial Serial3(PB11,PB10);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial2.begin(9600);
  Serial3.begin(9600);
    
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println ("Serial : HELL000");
  Serial2.println("Serial2: Hell");
  Serial3.println("Serial3: Lo !");
  delay(1000);
}
And it's done! Thank you for your help! :D
Post Reply

Return to “General discussion”