Skip to main content
PRedd.5
Associate II
October 15, 2019
Solved

How is IT different from DMA at a hardware level ?

  • October 15, 2019
  • 3 replies
  • 1723 views

In DMA mode, the DMA block does copying. In normal mode the controller does the copying. So which block does copy in interrupt mode?

This topic has been closed for replies.
Best answer by PRedd.5

It becomes much clearer once you look up the implementation of :

HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)

HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)

both of them can do arbitrary size transfers.

Reading the TRM. RM0316 : page 885 Sec 29.2 :

"Received/transmitted bytes are buffered in reserved SRAM using centralized DMA"

They are basically the same operation using different channels and modes of DMA. If all you care is to perform UART input/output without the processing unit getting involved, either mode (IT or DMA) will do fine.

The use of DMA peripheral mode is to allow peripheral to peripheral transfer and peripheral triggered data transfer without invoking the processing unit.

3 replies

waclawek.jan
Super User
October 15, 2019

The controller.

JW

Tesla DeLorean
Guru
October 15, 2019

..under interrupt/callback context. Not burning cycles in polling loop, but interrupt entry/exit does have cost.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
PRedd.5
PRedd.5Author
Associate II
October 15, 2019

So the bus controller is the one doing the transfers instead of DMA. If the controller can do full size transfers , why is DMA used at all ?

When would you choose DMA over controller interrupt ?

PRedd.5
PRedd.5AuthorBest answer
Associate II
October 16, 2019

It becomes much clearer once you look up the implementation of :

HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)

HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)

both of them can do arbitrary size transfers.

Reading the TRM. RM0316 : page 885 Sec 29.2 :

"Received/transmitted bytes are buffered in reserved SRAM using centralized DMA"

They are basically the same operation using different channels and modes of DMA. If all you care is to perform UART input/output without the processing unit getting involved, either mode (IT or DMA) will do fine.

The use of DMA peripheral mode is to allow peripheral to peripheral transfer and peripheral triggered data transfer without invoking the processing unit.

Piranha
Principal III
October 16, 2019

> They are basically the same operation using different channels and modes of DMA. If all you care is to perform UART input/output without the processing unit getting involved, either mode (IT or DMA) will do fine.

No, you are wrong. Polling and interrupt modes are both done by CPU. This is the line where in interrupt mode CPU reads a byte from Tx buffer and writes it to peripherals Tx register:

https://github.com/STMicroelectronics/STM32CubeF3/blob/e684e8712c42ad70d801adf73ba3b509ed04a7ff/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart.c#L2678

> The computer architecture they taught 12 years ago is far behind modern DMA and bus controller implementations.

The original IBM PC in year 1981 had Intel 8237 DMA controller working on the same principles...