How to use Serial6 on STM32F411CE BlackPill

Hello,
I am using WeAct BlackPill STM32F411CE and wondering if I can and how to define the chips Serial6 UART port.

Currently I am using Serial1 for main i/o and will continue using it, but I want to move from i2c Gyro to a serial port Gyro. Problem is I have already used Serial2 pins for other functions and would be BIG issue to rewire/design my board.

Hence, how to use hardware Serial6 which is wired on the board to USB or I guess other option might be Software Serial but I am reluctant to try this I think this F411 is running flat out and Software serial might be too much for it.
Many thanks in advance imk

What STM32F4 board support package do you use?

stm32 arduino

Please provide the link

version 2..9.0

Did you try just to use Serial6?

Yes...see below

C:/Users/Me/AppData/Local/Arduino15/packages/STMicroelectronics/tools/xpack-arm-none-eabi-gcc/13.2.1-1.1/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\Me\AppData\Local\arduino\sketches\7CDB37B86C4FD7D841F155EA2862A09D\sketch\ARIAChassis-V1-3.ino.cpp.o: in function setup': ARIAChassis-V1-3.ino.cpp:(.text.setup+0xa0): undefined reference to Serial6'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

I haven't used STM32 processors much, but I'd be surprised if there wasn't a way to remap the I/O matrix so that Serial2 will appear on usable pins.

Serial2 can be remapped to PD5,PD6 but Blackpill does not have these pins.
Only option is Serial6 which does not seem defined or I guess software serial which I guess I'll have to take a look at. Thanks for the post.
IMK

Why not remap Serial2 to the pins current claimed as Serial6 pins?

As already requested once, please supply the link the exact board package you're using.

https://www.st.com/resource/en/datasheet/stm32f411ce.pdf
See pin mapping and alt pin mapping Table 8. and Table 9.
Only option I have is serial6 PA11 and PA12
But adding Serial6 to sketch produces compiler error!

this compiles OK but if I connect PA11 to PA12 for a loopback test as soon as I enter Serial monitor data it looses the serial port

// STM32 Black Pill STM32F401  F411  Serial6 test - for loopback test connect pins PA11 to PA12

HardwareSerial Serial6(PA11, PA12);;

void setup() {
  // initialize both serial ports:
  Serial.begin(115200);
  delay(3000);

  Serial6.begin(115200, SERIAL_8N1);
  Serial.println("\n\nSTM32 black pill  serial6  test RXD pin PA11 TXD pin PA12");
}

void loop() {
  // read from Serial1, send to Serial
  if (Serial6.available()) {
    int inByte = Serial6.read();
    Serial.write(inByte);
  }
  // read from Serial, send to Serial1
  if (Serial.available()) {
    int inByte = Serial.read();
    //Serial.write(inByte);     // local echo if required
    Serial6.write(inByte);
  }
}

EDIT: tried

HardwareSerial Serial6(PA12, PA11);;

same result

With HardwareSerial Serial6(PA11, PA12);; Serial6.begin compiles ok, thank you I forgot to add hardware serial.
I think the drop out when connecting to serial monitor maybe due to compiler options
USB Support->
or
U(S)ART Support Enable ->

There is nothing surprising in it because Serial6 and Serial are uses the same pins.

@imk123
I think you could just use the Serial object in place of Serial6 in your code.