cancel
Showing results for 
Search instead for 
Did you mean: 

Enable the UART2 Peripheral Clock

JLIND.1
Associate III

Hello, I am doing a UART example and I need to find the command to Enable the UART2 Peripheral Clock. I have enabled the GPIO clock:

__HAL_RCC_GPIOA_CLK_ENABLE(); // stm32f4xx_hal_rcc.h

and now I need to enable the UART2 Clock Peripheral.

Can anyone please help me.

Thank you,

Joe

8 REPLIES 8
JLIND.1
Associate III

I see a command: __HAL_RCC_USART2_CLK_ENABLE

but that is for the USART2, not UART2.

Correct it is USART2, but you're using the simpler async only library​, which supports a subset of functionality common between UART and USART peripheral IP.

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

Hello, thank you very much for responding to my message. What async library should I be using or is this okay for now?

I am going though a Udemy class on the FreeRTOS: "Mastering RTOS: Hands on FreeRTOS and STM32Fx with Debugging" which is very good course. The course instructor uses the System Workbench IDE and he uses the Standard Peripheral Library but I was not able to download or add in that library so I must do what he is doing but use the HAL libraries. I have attached my first project using Tasks.

Thank you,

Joe

Could you help me one more time. What is the equivalent HAL command for :

GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF7_USART2)

GPIO_PinAFConfig(GPIOA, GPIO_PinSource3, GPIO_AF7_USART3)

I'm trying to set up the Alternate Function for pins 2 and 3.

Can you please help me.

Thank you

I forgot to add that I am using the Nucleo-F446RE Board.

Piranha
Chief II

Thank you very much. I finally got things working.