Page 2 of 2

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

Posted: Mon Aug 16, 2021 6:05 pm
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() {

 
} 

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

Posted: Mon Aug 16, 2021 6:53 pm
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.