Skip to main content
Graduate
June 29, 2021
Question

HAL_UART_ErrorCallback(UART_HandleTypeDef *huart) behavior

  • June 29, 2021
  • 1 reply
  • 907 views

I'm not using the internal autobaud system.

but i do try to catch wrong baudrate's by monitoring the ORE flag.

The ORE flag is never '1' when i run the program full speed, but when i add a breakpoint in the callback and step ORE is flagged correctly ?

Why does ORE not flag at full speed? Are there other ways to catch a wrong baudrate ?

void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart){
	isrreg[isregcnt++] = eic.phuart->Instance->ISR;
	if(isregcnt>30) isregcnt=29;
 
	if ((eic.phuart->Instance == huart->Instance)) {
		if ((eic.phuart->Instance->ISR & USART_ISR_ORE) != 0) {
			bBaudError=1;
		}
	}
	HAL_UARTEx_ReceiveToIdle_DMA(huart,(uint8_t*)eic.DMABuff,DMABUFF_SIZE);
	__HAL_DMA_DISABLE_IT(eic.phdma_usart_rx,DMA_IT_HT);
}

Thank you

Steve

    This topic has been closed for replies.

    1 reply

    Super User
    June 29, 2021

    Flags are cleared prior to the HAL callbacks. Look for the error reason in the ErrorCode member.

     huart->ErrorCode |= HAL_UART_ERROR_ORE;