2017-11-12 12:25 AM
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(); }#uart2017-11-12 04:31 AM
Make sure the RCC configuration (clock enable) for the UART and the related GPIO port are enabled.
Make sure the GPIO AF (Alternate Functions) are properly setup
2018-03-07 07:31 PM
Do you generate by CUBEMX, please post your project files too