2015-04-29 05:13 AM
I'm still confused by HAL UART API. I'm using latest STM32Cube (4.7) for stm32f103rb.
In the latest HAL there are two files - stm32f1xx_hal_uart.c and stm32f1xx_hal_usart.c. In the UM1850 (description of STM32F1xx HAL drivers) there are two chapters - one about UART and another one about USART; they mention different functions from those two files.So I presumed that UART should be initiated and accessed via HAL_UART_ functions and USART - via HAL_USART_ ones.Okay. So I created a project in the Cube and enabled USART1. But for some reason, in the generated project only stm32f1xx_hal_uart.c was added and USART1 was configured with HAL_UART_Init!Am I missing something? Maybe USART functions are deprecated and will be removed in the future releases? #stm32f1 #hal #uart2015-04-29 01:14 PM
This article might be helpful:
http://www.micromouseonline.com/2009/12/31/stm32-usart-basics/
as it specifically addresses the UARTs and USARTs on the F103xx. A USART can be used as a UART (by ignoring the CK signal, which is used for synchronization). That signal does not exist on the two true UARTs (UART4 and UART5). UARTs 1-3 can operate either synchronously (using the HAL_USART interface) or asynchronously (using the HAL_UART interface).You should also familiarize yourself with the hardware for your specific device via the appropriate User Manual, which in your case is RM0008:http://www.st.com/web/en/resource/technical/document/reference_manual/CD00171190.pdf
2015-04-30 01:28 AM
Riight, so when I use USART in synchronious mode, cube generates calls of HAL_USART functions.. and huart1 handle becomes husart1 handle and changes it's type.
Okay, fair enough. It still seems a bit strange to me but at least there is a logic in it. Thanks!