7 years, 11 months ago.

additional UART devices

Hi, I want to add more UART devices to my nucleo F401RE. I checked on my compiler that USBRX and USBTX is mapped to P0_2 and P0_3, what I cant seem to find out is what port pins are these? because according to the datasheet, these pins are connected to PA13 and PA14. but where is it declared that P0_2 or P0_3 is either PA13 or PA14?

essentially I wish to connect 2 UARTs to read from a uart RFID reader. is there any tutorials that you can suggest I look at for inter board communications instead of PC to PC?

thanks

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F401RET6 microcontroller.

2 Answers

7 years, 11 months ago.

One way is to look up the board in MBED-SRC and see what the definitions are in PinNames.h.

P0_2, P0_3 looks more like NXP notation, it looks as if STM give their ports letters.

Looking in:

https://developer.mbed.org/users/mbed_official/code/mbed-src/file/a11c0372f0ba/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F401RE

SERIAL_TX = PA_2, SERIAL_RX = PA_3, USBTX = PA_2, USBRX = PA_3,

Looking further it looks as if there may be further UART devices on pins PA_9,PA_10 (alts at PB_6,PC_7) and PA_11, PA_12 (alts at PC_6,PC_7)

Accepted Answer

yes, you are correct, I looked up on the wrong code. figured it out afterwards. also , PA_2 and PA_3 are used for uart which I noticed afterwards as well. I will have to look further into uart to see communication between multiple devices.

posted by ovi rahman 25 May 2016
7 years, 11 months ago.

Where did you get this P0_2 and P0_3, since the F401 does not have these pins it is incorrect. They are connected to PA_2 and PA_3 according to the pinout (D0 and D1, and no it makes no sense to connected USBTX/USBRX to D0 and D1). https://developer.mbed.org/platforms/ST-Nucleo-F401RE/

Next question, where in the datasheet does it say it is PA_13 and PA_14.

Now that pinout graph does not show all Serial (UART) connections, but it does show some of those you can use. Serial 2 is used by USBTX/USBRX, so you can use the Serial 1 and Serial 6 ones printed there. Otherwise check the reference manual for example to get other UART pins.

Hi there, I went ahead and checked on what you said, helped me look for what I needed. noticed I was looking at the code for some other board. found the right code and found my PA_2 and PA_3. also saw that PA13 and PA14 which were 2 nets in the schematics were there for programming the nucleo via ST_link and had nothing to do with uart in the first place (d'oh). ive spent a bit of time scanning through the uart section in the manual, i am a bit confused but I think I can make it work, would i be able to connect a uart to any IO pins by setting the class in mbed? like Serial dev2(PC_2, PC_3);?

posted by ovi rahman 25 May 2016

You can only do it with pins which support UART, such as those listed in the platform page and/or those in the pinout file.

If you want to use random pins you can use the SoftSerial library, however it is preferred to use the listed pins.

posted by Erik - 25 May 2016