2023-01-11 12:55 AM
The code generated by the STM32CubeMX is using the UART rather than the USART.
How do we generate the code using the USART driver lib via the CubeMX?
Solved! Go to Solution.
2023-01-11 01:35 AM
Hi @Community member
USART1, USART2, ... and/or UART4 or UART5, ... are instances of peripherals, able to achieve UART/USART communications.
Usually, USARTx instances are able to handle :
- UART comms : Asynchronous communication, no CLK signal
- USART comms : Synchronous, based on a CLK signal
while UARTy instances only handle :
- UART comms : Asynchronous communication, no CLK signal
So depending on what type of communication you want to handle, you need to select the appropriate type in CubeMx configuration :
"Asynchronous" => Use of HAL UART API, UART comm type
"Synchronous" => Use of HAL USART API, USART comm type
Hope this answers your question
Regards
2023-01-11 01:01 AM
Using the STM32L412 with the latest CubMx and Lib.
2023-01-11 01:25 AM
It's the same driver for both types
2023-01-11 01:35 AM
Hi @Community member
USART1, USART2, ... and/or UART4 or UART5, ... are instances of peripherals, able to achieve UART/USART communications.
Usually, USARTx instances are able to handle :
- UART comms : Asynchronous communication, no CLK signal
- USART comms : Synchronous, based on a CLK signal
while UARTy instances only handle :
- UART comms : Asynchronous communication, no CLK signal
So depending on what type of communication you want to handle, you need to select the appropriate type in CubeMx configuration :
"Asynchronous" => Use of HAL UART API, UART comm type
"Synchronous" => Use of HAL USART API, USART comm type
Hope this answers your question
Regards
2023-01-11 06:14 AM
Thanks. Got it. That mean the USART only be used when the synchronous mode selected. If the only asynchronous mode used, the CubeMX will only use the UART lib.