cancel
Showing results for 
Search instead for 
Did you mean: 

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

Hicham Chaabane
Associate III
Posted on April 05, 2018 at 17:03

Hello,

Following my question here 

https://community.st.com/0D50X00009XkWuQSAV

 , 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

https://community.st.com/0D50X00009XkW2nSAF

  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(&

UART

Handle);

            /* Here we disable the DMA stream to trig manually a TC interrupt */ //<-- dosn't work !

            __HAL_DMA_DISABLE(

UART

Handle.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!

#stm32f457 #uart-interrupt #dma-uart
5 REPLIES 5
Tilen MAJERLE
ST Employee
Posted on April 05, 2018 at 21:39

c.malki

‌,

disabling DMA will only work on the devices where streams are introduced, so F2, F4, F7 and some DMAs in H7. In fact, you don't disable DMA but you disable DMA stream. L4 does not implement DMA streams thus this feature does not work.

In this case you need to (I propose) use single thread to poll DMA NDTR register and check if you have any new data received. On the topic (How to efficiently use UART RX with DMA) you have 3 examples which show different configurations.

Best regards,

Tilen

Posted on April 06, 2018 at 10:01

Thank you Tilen, Now it makes sense.

Hi Tilen,

I can't find the topic (How to efficiently use UART RX with DMA), could you attach the link for me?

Thanks

Jay

BSchm.0
Associate II

Hi Tilen, I couldn not find the link for the examples too. Can you attach the link?

I have a STM32303-EVAL and have the same trouble.

Thanks Boris

Tilen MAJERLE
ST Employee