cancel
Showing results for 
Search instead for 
Did you mean: 

DMA Uart Rx occur only once

MGuil.1
Associate II

I have followed an example found on the web to get DMA RX usart2 running.

I had activate RX DMA, global interrupt in cubmx project.

In the main I have :

HAL_UARTEx_ReceiveToIdle_DMA(&huart2, RxBuf, RxBuf_SIZE);
  __HAL_DMA_DISABLE_IT(&hdma_usart2_rx, DMA_IT_HT);

and I added the callback function:

void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
	if (huart->Instance == USART2) {
		memcpy(MainBuf, RxBuf, Size);
		HAL_UARTEx_ReceiveToIdle_DMA(&huart2, RxBuf, RxBuf_SIZE);
		__HAL_DMA_DISABLE_IT(&hdma_usart2_rx, DMA_IT_HT);
	}
}

Then when I launch the debbug, the callback function is well called, but only one time, and never called back again.

Did I miss something to re-activate the callback ?

I'm using a nucleo H743 board.

Thnaks for your help.

10 REPLIES 10
MGuil.1
Associate II

I know that because it hit the breakpoint in UART4_IRQHandler only once.

I had add a led toggle in the IT and it is the same the led light switch on and never switch off with some character I sent from my computer to the nucleo...

It is the same if I remove this function:

> MX_ETH_Init();

> MX_USART3_UART_Init();

> MX_UART4_Init();

> MX_USB_OTG_FS_PCD_Init();