2023-11-30 03:22 AM
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
2023-11-30 04:41 AM
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.
2023-11-30 04:45 AM
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?
2023-11-30 04:49 AM
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.
2023-11-30 07:52 PM - edited 2023-11-30 07:59 PM
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
2023-11-30 07:56 PM
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
2023-11-30 07:57 PM
HI Host is sending char(C) as per showing on serial terminal