cancel
Showing results for 
Search instead for 
Did you mean: 

UART TIME OUT

PESHWA
Associate II

Hello everyone 

I am trying to receive file form UART through Xmodem protocol I am getting file in debug mode but unable to get into run mode it showing  UART Rx busy basically hanging over these function 


while (!(HAL_UART_GetState(&huart4) == HAL_UART_STATE_READY) && wTimeout) {
wTimeout--;
}

if (HAL_UART_GetState(&huart4) == HAL_UART_STATE_READY)
break;
}

Can anyone suggest me for the what's wrong with the code  

6 REPLIES 6
FBL
ST Employee

Hello @PESHWA 

Could you specify the product being used, please?

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

The host isn't sending data?

You've got some stuck error status like noise, framing, parity, overrun that you need to clear before reception works?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

The timeout also isn't time bound it's iteration bound and this can change depending on execution speed and optimization. You need it to run in consistent time.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PESHWA
Associate II

yes STM32L4 MCU and with help of tera term as serial terminal as any idea why this happening 

 

NOTE : I am using IAR workbench as IDE 

Hi

I am doing in consistent time frame 

/* USER CODE END UART4_Init 1 */
huart4.Instance = UART4;
huart4.Init.BaudRate = 19200;
huart4.Init.WordLength = UART_WORDLENGTH_8B;
huart4.Init.StopBits = UART_STOPBITS_1;
huart4.Init.Parity = UART_PARITY_NONE;
huart4.Init.Mode = UART_MODE_TX_RX;
huart4.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart4.Init.OverSampling = UART_OVERSAMPLING_16;
huart4.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart4.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart4.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart4) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_SetTxFifoThreshold(&huart4, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_SetRxFifoThreshold(&huart4, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_DisableFifoMode(&huart4) != HAL_OK)
{
Error_Handler();
}

here are my uart configuration and Iam using uart interrupt for communicate  

HI Host is sending char(C) as per showing on serial terminal