cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_ErrorCallback(UART_HandleTypeDef *huart) behavior

sde c.1
Senior II

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

1 REPLY 1
TDK
Guru

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

      huart->ErrorCode |= HAL_UART_ERROR_ORE;

If you feel a post has answered your question, please click "Accept as Solution".