cancel
Showing results for 
Search instead for 
Did you mean: 

UART transmitting in Interrupt mode vs. DMA mode

Daniel Studer
Associate II
Posted on June 15, 2017 at 09:35

Hello,

I'm working with an STM32F7xx with the Cube HAL library. Im using the UART and I tried all 3 transmitting functions of UART. These are HAL_UART_Transmit, HAL_UART_Transmit_IT and HAL_UART_Transmit_DMA. all 3 methods are working well. But I dont't really understand the difference between the Interrupt and DMA method.

In Interrupt method I just give a pointer to my sending data to the function as same with the DMA function. In debugging mode I see that the Interrupt function is doing less code than the DMA function. My question now is, is the processor executing more code in interrupt mode than in DMA mode after these functions are called? I can't see that the processor is  executing more in Interrupt mode. I thought with DMA the processor is less involved than without DMA.

Thanks for helping.

Best regards,

Dani

1 REPLY 1
Posted on June 15, 2017 at 10:26

Generally, there might be more to do when setting up a DMA, but then data are sent/received without processor involvement in DMA mode, until the predetermined number of transfers have been reached. It means, no code executed for individual characters, only when a buffer is full(Rx)/emptied(Tx).

When using interrupts, upon every character the interrupt service is executed.

I don't know what sort of profiling did you use and what amount of data you've processed, this might all play a role. And I definitively won't investigate/comment on Cube.

JW