cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling USART2 on STM32F413

jkasper
Associate II

Hello!

I am wondering what the high level process for enabling a USART port is.

I am enabling

RCC_AHB1ENR_GPIODEN

RCC_APB1ENR_USART2EN

But the TX line stays low. I am guessing it has to do with the clock?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Enable the clocks (GPIO and USART)

Config the pins, AF MODE, associate the AF (Alternate Function) mux with the setting for the given peripheral. There's a table in the Data Sheet/Manual

Config the USART, baud rate based on APB clock, enable RX/TX, enable UART

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

Enable the clocks (GPIO and USART)

Config the pins, AF MODE, associate the AF (Alternate Function) mux with the setting for the given peripheral. There's a table in the Data Sheet/Manual

Config the USART, baud rate based on APB clock, enable RX/TX, enable UART

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
KiptonM
Lead

If you are using the Nucleo board look at User Manual UM1724 Paragraph 6.8

6.8 USART communication

The USART2 interface available on PA2 and PA3 of the STM32 microcontroller can be connected to ST-LINK MCU, ST morpho connector, or to ARDUINO® connector. The choice can be changed by setting the related solder bridges. By default, the USART2 communication between the target STM32 and ST-LINK MCU is enabled, in order to support virtual COM port for Mbed™ (SB13 and SB14 ON, SB62 and SB63 OFF). If the communication between the target STM32 PA2 (D1) or PA3 (D0) and shield or extension board is required, SB62 and SB63 must be ON, while SB13 and SB14 must be OFF. In such a case, it is possible to connect another USART to ST-LINK MCU using flying wires between the ST morpho connector and CN3. For instance, on NUCLEO-F103RB it is possible to use USART3 available on PC10 (TX) and PC11 (RX). Two flying wires need to be connected as follow:

•PC10 (USART3_TX) available on CN7 pin 1 to CN3 pin RX

•PC11 (USART3_RX) available on CN7 pin 2 to CN3 pin TX