Skip to main content
Explorer
July 7, 2023
Solved

STM32G491 LPUART OVERRUN(ORE) ERROR

  • July 7, 2023
  • 1 reply
  • 3342 views

Ekran görüntüsü 2023-07-07 162337.pngEkran görüntüsü 2023-07-07 162306.pngEkran görüntüsü 2023-07-07 162257.pngEkran görüntüsü 2023-07-07 162245.png

 

 

void rs485_gelen()
{
		memset(dnm,0,0);
		HAL_GPIO_WritePin(DNM_EN_GPIO_Port, DNM_EN_Pin, 0);
		HAL_UARTEx_ReceiveToIdle_IT(&hlpuart1, dnm, 100);

}
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
	if(huart->Instance == LPUART1)
	{
		memset(dnm,0,0);
		HAL_UARTEx_ReceiveToIdle_IT(&hlpuart1, dnm, 100);

	}
}void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart)
{
	if(huart->Instance == LPUART1)
	{
		if (huart->ErrorCode & HAL_UART_ERROR_ORE) {
			 HAL_UARTEx_ReceiveToIdle_IT(&hlpuart1, dnm, 100);
		}
	 }
	}

 

 

Hi everyone, I have a problem about UART_ReceiveToIdle_DMA. I receive data with baud rate 500000bits/s. I checked the reference manuel, it says stm allows to baud rate up to USART Clock/3 and my clock is 150Mhz. 
Here is my problem;

1) ReceiveToIdle_DMA does not detect Idle. I enabled NVIC and DMA settings and used RxEvent Callback. Even though there is Idle in data, it keeps receiving and writes to all buffer.
2) When I use UART Error Callback, it just receive 1 or 2 bytes. I check error flags and it almost every time gives ORE.

I searched about it and check RXNE and IDLEF flags in error call back, these are 1 every time. I don't know what to do exactly but tried to clear flags in error callback but it also does not work. Anyone have any idea?

 

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    I'd assume something else is amiss if the DMA is incorrect, or started too late. Check DMA unit status.

    Perhaps implement with interrupts and get some data and timing metrics. Assume its not actually zero length, use sizeof()

    memset(dnm,0,0);

     

    1 reply

    Graduate II
    July 10, 2023

    I'd assume something else is amiss if the DMA is incorrect, or started too late. Check DMA unit status.

    Perhaps implement with interrupts and get some data and timing metrics. Assume its not actually zero length, use sizeof()

    memset(dnm,0,0);

     

    MÇETİ.1Author
    Explorer
    August 24, 2023

    Hi, 
    Thanks for your reply and apologize to answer too late. I change my IC and reset enable pin in error and rx callback and problem solved. 

    HAL_GPIO_WritePin(DNM_EN_GPIO_Port, DNM_EN_Pin, 0);

     And also the quotation that you give from the kod, it was a mistake, I ought to write different size I change it.

    Thank you again,
    Sincerely