AnsweredAssumed Answered

Disabling DMA has no effect on DMA transfer compelete flag (TCIF)

Question asked by Hicham Chaabane on Apr 5, 2018
Latest reply on Apr 6, 2018 by Hicham Chaabane

Hello,

 

Following my question here DMA doesn't copy data from UART RDR , I'm able to receive data from the UART peripheral to the specified buffer.

Now I'm trying to implement the same method described here Efficiently use DMA with UART RX on STM32  but it's not working as expected !.

Precisely, when disabling the DMA enable bit in the CCRx register, the flags (TCIFx, GIFx..etc) don't set and no DMA interrupt is generated.

 

I did the following test :

 

I set the RX data size to a small number (4) and then send more than 4 bytes through the UART. A DMA interrupt is generated and goes to the right handler, DMA1_Channel3_IRQHandler in my case.

The HTIF3, TCIF3 and GIF3  are set in the ISR register. until now everything is working as expected.

 

But when I send only one byte. UART IDLE flag is set, in the USART3_IRQhandler I disable the DMA (CCR3->EN)and expect to have one of the flags  HTIF3, TCIF3 or GIF3 set but it is not the case.

PS. The TCIE in the CCR3 is enabled 

 

Here is the UART handler

 

void USART3_IRQHandler(void)
{
      if((UARTHandle.Instance->ISR & USART_ISR_IDLE) != RESET)
      {

            __HAL_UART_CLEAR_IDLEFLAG(&UARTHandle);

            /* Here we disable the DMA stream to trig manually a TC interrupt */ //<-- dosn't work !
            __HAL_DMA_DISABLE(UARTHandle.hdmarx);
      }
}

I'm using stm32L475 and didn't find any mention of forcing a call transfer complete interrupt by disabling the DMA  ?

 

Any suggestions would be much appreciated!

Outcomes