AnsweredAssumed Answered

Issue using HAL UART Transmit

Question asked by Jean Paul Talledo Vilela on Nov 12, 2017
Latest reply on Mar 8, 2018 by William chang

Hello

 

I am having issues with the following HAL function when trying to transmit data using HAL library:

if(UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_TXE, RESET, tickstart, Timeout) != HAL_OK)

 

It always return HAL_TIMEOUT.

 

I am setting serial port with:

 


/* USART3 init function */
static void MX_USART3_UART_Init(void)
{

 

  huart3.Instance = USART3;
  huart3.Init.BaudRate = 115200;
  huart3.Init.WordLength = UART_WORDLENGTH_8B;
  huart3.Init.StopBits = UART_STOPBITS_1;
  huart3.Init.Parity = UART_PARITY_NONE;
  huart3.Init.Mode = UART_MODE_TX_RX;
  huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  huart3.Init.OverSampling = UART_OVERSAMPLING_16;
  if (HAL_UART_Init(&huart3) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }

 

}

 

 

and then transmitting data with:

 

      if(HAL_UART_Transmit(&huart3, (uint8_t*)aTxBuffer, TXBUFFERSIZE, 5000)!= HAL_OK)
          {
            Error_Handler();
          }

Outcomes