Skip to main content
Associate
February 28, 2024
Question

UART Transmit issue

  • February 28, 2024
  • 2 replies
  • 2328 views

Hi there,

I have a gps receive code on f411 black-pill, and it is work fine. Recently, the system updated software packages to F4 1.28.0, found that the HAL library HAL_UART_Transmit does not work on each UART tx port, but HAL_UART_Receive_IT normal, I wonder if anyone is experiencing the same problem, and how to solve it. The function of HAL_UART_Transmit just use for printf as following

 

int __io_putchar (int ch)

{

HAL_UART_Transmit (&huart1, (uint8_t *)&ch, 1, 0xFFFF);

return ch;

} /* __io_putchar() */

 

 

2 replies

Andrew Neil
Super User
February 28, 2024

Please use this button to properly post source code:

AndrewNeil_0-1709116165966.png

 

You're not checking the return value of HAL_UART_Transmit - you should do that, and see if it's giving you an error code to identify what's going wrong.

Have you tried stepping into HAL_UART_Transmit to see what's happening?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
JamesLinAuthor
Associate
February 28, 2024

Hi Andrew,

Thanks for your information. I have step into HAL_UART_Transmit, and the HAL_UART_Transmit return HAL_OK, as the attachment. So, I have no idea on the problem.

Andrew Neil
Super User
February 28, 2024

How do you determine that it's not transmitting?

Have you checked for activity at the STM32 pins ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
February 28, 2024

@JamesLin wrote:

Recently, the system updated software packages to F4 1.28.0, found that the HAL library HAL_UART_Transmit does not work ... but HAL_UART_Receive_IT normal


Similar:

https://community.st.com/t5/other-software/hal-uart-transmit-issue-after-f4-1-28-0-update/td-p/645168 ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.