8 years, 7 months ago.

Use of multiple USART/SPI/I2C/Timers on STM32

1. Say, if I want to use three usart at the same time, on NUCLEO-F411RE. I can use them as

Serial usart1(pin_tx, pin_rx); # pin_tx = PB_6, PA_9, PA15, pin_rx = PA10, PB3, PB7

Serial usart2(pin_tx, pin_rx); # pin_tx = PA_2, pin_rx = PA3,

Serial usart6(pin_tx, pin_rx); # pin_tx = PA_11, PC_1, PC_6, pin_rx = PC7, PA12

Is my understanding correct? Are all these pin combinations good to use??? If so, I can enumerate for SPI/I2C as well.

2. But for the timers, how can I use 8 different timers at the same time?

Thank you!

Question relating to:

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

1 Answer

8 years, 7 months ago.

Regarding usarts: Yes, although you may give them any name (and pin_tx/pin_rx are of course the pinnames you want to use). So instead of usart6, you can also call it my_random_serial_name. If those pinnames are listed as Serial pins they should work. Only note that PA_2 and PA_3 are also used for the USB serial connection, and by default are not connected to the pins on your nucleo board (see the nucleo manual). Here are all the defined pinouts: https://developer.mbed.org/users/mbed_official/code/mbed-src/file/c9b73cd93427/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_NUCLEO_F411RE/PeripheralPins.c

For timers, you can make as many as you want (within reason), they are all mapped by software on a single hardware timer. So just Timer timer1; Timer timer2; Timer timer_with_any_other_name;

Accepted Answer