Page 1 of 1

USART on STM32F411 BlackPill

Posted: Fri Jul 31, 2020 8:46 pm
by konczakp

Could someone explain me why on earth on the board diagram of the blackpill there are three USART1 ports (rx1 on pins PA10,PB3,PB7 ant tx1 on pins PA9,PA15,PB6). I was able to run USART1 on PB6 and PB7, USART2 on PA3 and PA2 and the USB-C is on the PA11 and PA12. Are the other USART1 pins some how usable as separate rx-tx ports. If Yes than How? If not then why they are there. Usually if some pins are multi usage (like USART and I2C etc) then they are usable but in this case I was not able to get the other USART1 to run.


Re: USART on STM32F411 BlackPill

Posted: Sat Aug 01, 2020 7:19 am
by GonzoG
Those are alternate pins.
PA9 and PA10 are used with USB,
PB6 and PB7 are used with I2C1
so if you cannot use them you have 3rd pair: PA15 and PB3 but you need to change pin assignment: ... wareserial

Re: USART on STM32F411 BlackPill

Posted: Sat Aug 01, 2020 10:16 am
by stevestrong
Which block diagram do you refer to?
How did you manage to use USART1 on PB6/7?
Please always post links/code, otherwise we cannot read your thoughts.
PA9/10 are usually TX1, RX1.
PA11/12 are USB pins.

Re: USART on STM32F411 BlackPill

Posted: Sat Aug 01, 2020 3:00 pm
by konczakp
Thanks GonzoG for the link. I omitted this info somehow ... But thanks to this I was able to redirect USART1 to different pins. At the begining I was doing this wrong.
SteveStrong You are right, thanks for the correction. I've made a mistake in first post putting wrong pin names.
Now HW Serial is working as in here:

Code: Select all

HardwareSerial Serial2(USART2);

#include <SoftwareSerial.h>

SoftwareSerial mySerial(PB1, PB0); // RX, TX

void setup() {

void loop() {
  Serial1.println("hello 1");
  Serial2.println("hello 2");
  mySerial.println("hello 3");

I was referring to this diagram*ixFS ... 0w6jFA.png

Unfortunately I'm still having problems with getting the SoftwareSerial running. It is also in the code above and it is not sending any data. Someone else has similar problem so I wrote also in other thread but still nothing. Can You guys help me with this also?

Re: USART on STM32F411 BlackPill

Posted: Fri Apr 02, 2021 12:12 pm
by elliotP890
Hey guys,

I'm in the same position as the original post, and I'm having difficulty understanding the replying posts. I need to use 2 serial ports for a drone project on my STM32F411 board. One is for my reciever (just an Rx pin), and one for a GPS module. Using the same pinout diagram that's been posted here already:*ixFS ... 0w6jFA.png

I don't understand why there are multiple serial1 ports and if its possible to use 2 different serial ports. I'm also using the usb occasionally to use the serial monitor in Arduino. Are the multiple serial1 ports simply just different pins to redirect USART1 or can I using them as separate serial connections?
Also why is there Tx6 and Rx6 (A11 and A12) on the board? Really struggling to understand this, my understanding was that different serial ports were labelled Tx/Rx and numbered accordingly. Can someone help me understand this?


Re: USART on STM32F411 BlackPill

Posted: Fri Apr 02, 2021 12:49 pm
by ag123
normally uart1 is on pa9, pa10
uart2 is on pa2, pa3

other things are check in the core files if they are declared that way, or if you are declaring it manually you may need to specify the pns ... wareserial

then some functions can be remapped to other pins, but if you are able to use the default pins above, they could be 'easier'