2021-12-23 03:01 AM
I'm using STM32L476 MCU.
I config DMA Setting for USART.
And I use HAL_UART_Receive_DMA in main.c
If I received data, test_count always increase two.
void DMA1_Channel6_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Channel6_IRQn 0 */
test_count ++;
/* USER CODE END DMA1_Channel6_IRQn 0 */
HAL_DMA_IRQHandler(&hdma_usart2_rx);
/* USER CODE BEGIN DMA1_Channel6_IRQn 1 */
/* USER CODE END DMA1_Channel6_IRQn 1 */
}
Is there anyone who can help?
Solved! Go to Solution.
2021-12-23 07:03 AM
It increases once for the HT interrupt and one for the TC interrupt. Working as intended.
If you want to do something at the end of the transfer, implement and use HAL_UART_TxCpltCallback.
2021-12-23 07:03 AM
It increases once for the HT interrupt and one for the TC interrupt. Working as intended.
If you want to do something at the end of the transfer, implement and use HAL_UART_TxCpltCallback.
2021-12-23 08:17 AM
Thank you.
I don't want to use callback function.
So I changed code.
/* Set the UART DMA transfer complete callback */
huart->hdmarx->XferCpltCallback = UART_DMAReceiveCplt;
/* Set the UART DMA Half transfer complete callback */
//huart->hdmarx->XferHalfCpltCallback = UART_DMARxHalfCplt;