cancel
Showing results for 
Search instead for 
Did you mean: 

USART busy just after initialization

npatil15
Associate III

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

 

2 REPLIES 2
TDK
Super User

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".
npatil15
Associate III

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