cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0 TX Busy Flag Set when ClockPrescaler is 8

gceti.1
Associate II

Hi,

 

HAL_UART_STATE_BUSY_TX is always Set when I change the ClockPrescaler of USART Paremeter.

gceti1_0-1728306451623.png

My Cube configurations are in photo above. I have to drive Usart with 100 Baudrate. Systemclock Frequency is 50Mhz.

 

gceti1_1-1728306542177.png

 

When SystemClock is 50Mhz and ClockPrescaler is 1, it limits in order to set baudrate of USART. It says "Baud Rate must be between 763 Bits/s and 3.125 MBits/s." .Therefore I set ClockPrescaler to 8. 

When program has started, USART has stopped after send USART 3-4 bytes. I am using HAL_UART_Transmit_DMA to transmit with USART. When I checked inside of transmit function, I saw huart->gState flag is always HAL_UART_STATE_BUSY_TX and newer be set ready. 

 

I didnt solve where is the problem? Could you please help me to solve it please?

 

 

4 REPLIES 4
TDK
Guru

HAL_UART_STATE_BUSY_TX indicates the process is currently running and is not yet complete. If it never completes, perhaps an error condition happened. You will need to check for and clear any error conditions in the HAL_UART_ErrorCallback callback. The error condition will be indicated in the ErrorCode member of the handler. You can also debug the program, pause it when the error occurs and examine the handle and/or UART registers to see what happened.

If you feel a post has answered your question, please click "Accept as Solution".

Hi,

Thank you for your reply. I checked out the HAL_UART_ErrorCallback callback. It looks there are no errors occured, the error callback function never called. 

While everything is same, changing of prescaler as huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1; works perfectly. What changes when set prescaler to huart3.Init.ClockPrescaler = UART_PRESCALER_DIV8; ?

gceti.1
Associate II

Hello,

Is there any one facing with this issue? 

The main problem is ClockPrescaler of Uart, If I let it as UART_PRESCALER_DIV1 everything is fine, except UART_PRESCALER_DIV1 it goes to error. 

For instance

Let baudrate 9600 bps. 

If UART_PRESCALER_DIV1 is it works,

Without changing anything except Uart Prescaler, error occurs.

 

 

gceti.1
Associate II

Hello again,

I solved the problem.

I am using STM32G070CBTx MCU. ClockPrescaler feature is not available on USART3 peripheral. Everything is fine with using same configuration with USART1 peripheral.

 

100 Baudrate or lower can be using with setting ClockPrescaler with USART1 and USART2. The others (USART3 and USART4) is not compatible with ClockPrescaler parameter.

 

I did not find information about this issue. May be ClockPrescaler parameter is not selectable for USART3 and USART4