Skip to main content
Senior
July 25, 2025
Solved

USART busy just after initialization

  • July 25, 2025
  • 2 replies
  • 240 views

Hello,

Working on STM32F767BITx and using Free RTOS

Enable USART2, here is the init code

static void MX_USART2_UART_Init(void)
{
 huart2.Instance = USART2;
 huart2.Init.BaudRate = 115200;
 huart2.Init.WordLength = UART_WORDLENGTH_8B;
 huart2.Init.StopBits = UART_STOPBITS_1;
 huart2.Init.Parity = UART_PARITY_NONE;
 huart2.Init.Mode = UART_MODE_TX_RX;
 huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
 huart2.Init.OverSampling = UART_OVERSAMPLING_16;
 huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
 huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
 if (HAL_RS485Ex_Init(&huart2, UART_DE_POLARITY_HIGH, 0, 0) != HAL_OK)
 {
 Error_Handler();
 }
}

So I can see even just after init or even after some times, the gstate == 0x20 always, and thats why unable to transmit any message over uart as it is not ready.

Please guide me what is missing here.

Thanks,

Nitin

 

Best answer by npatil15

Hello,

Its my mistake,

Firstly, 0x20 is a ready signal as expected, and second, I was not passing correct UART instance, which cause the communication break.

Thanks for your time

2 replies

TDK
Super User
July 25, 2025

What hardware is this one? Are the pins being pulled to their proper idle state?

"If you feel a post has answered your question, please click ""Accept as Solution""."
npatil15AuthorBest answer
Senior
July 25, 2025

Hello,

Its my mistake,

Firstly, 0x20 is a ready signal as expected, and second, I was not passing correct UART instance, which cause the communication break.

Thanks for your time