[Solved] Multiple serial port at the same time doesn't work

Post here all questions related to STM32 core if you can't find a relevant section!
mwon
Posts: 6
Joined: Fri May 21, 2021 12:25 pm

Re: [Solved] Multiple serial port at the same time doesn't work

Post by mwon »

Ok, thanks. That makes sense and I now understand that I can't use Serial simultaneously in PA9, PA10 and PB6, PB7 with STM32F411CEU. I have now tried with USART2 and it worked fine. The code:

Code: Select all

HardwareSerial RPI(PB7,PB6);
HardwareSerial DEBUG(USART2);

void setup() {

  RPI.begin(115200);
  DEBUG.begin(115200); // begin Serial
  delay(1000);
  DEBUG.println("debug");
  RPI.println("RPI");

}

void loop() {

 
} 
ag123
Posts: 1673
Joined: Thu Dec 19, 2019 5:30 am
Answers: 25

Re: [Solved] Multiple serial port at the same time doesn't work

Post by ag123 »

another suggestion name your ports Serial1 and Serial2 after their respective uarts, it isn't necessary but that it'd save yourself some confusion at some later point after you have forgotten where each those definitions RPI and DEBUG is pointing to.
you can always indicate RPI or DEBUG as a comment next to the definitions.
Post Reply

Return to “General discussion”