2018-05-06 10:01 AM
Hallo everyone i have a question..
as i know the DMA receives Data und when it reaches the Bytes the i have determined it makes interrupt so this is usefull because the cpu doesn't wait the UART slow connection to finish.
but the DMA Transmit works I have tried to read so many sources in Internt and couldn't find out.
do the CPU as i think put the data in the DMA when it reaches the DMA send instruction and then continue to the second instruction without waiting the receiving Terminal to finish and let the DMA controller do the Job.. or how
thanks
2018-05-06 01:59 PM
The DMA feeds the USART a byte at a time as it requests them.
2018-05-06 05:38 PM
the DMA is a simple Hardware block.
it has a start position, a length, a type, Circular or Normal, and an input that says NEXT.
the Uart has a 2 byte Fifo, or commonly referred to as a 'double buffered Uart', this is to reduce the interrupt latency.
during transmit,
after a byte actually leaves the PIN, the TXE flag goes high, triggering the NEXT byte function from the DMA.
the next byte is shoved into the TX stream and the DMA waits for the NEXT high.
2018-05-07 01:10 AM
Hallo thanks for explantion but for example when i use this instruction:
HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
and sends 10 bytes then the CPU will hold on this instruction until it sends th 10 bytes or it sends 2 bytes and the others in memory for the dma controller to send them without the need of the main CPU or it waits because if it waits to send the 10 bytes what is the point of DMA transmition !
2018-05-07 08:02 AM
Hi
Ghadab.Majd
,To understand how the DMA works and how to use it efficiently, please have a look to
:Using the STM32F2, STM32F4 and STM32F7 Series DMA controller.HAL_UART_Transmit_DMA is used to start data processing (transmission) in this case.
Then the processing status may be followed based on the callbacks (for errors or completion).
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2018-05-07 10:37 AM
If you have doubts review the library source code, it is provided to allow you to do so.
As best I can tell it sets up the DMA transfer, and leaves. You can catch the completion in a call-back.
If the the USART isn't ready to accept bytes zero may be initially transferred.
DMA simple describes a buffer, it automates the transfer to the peripheral, and it services the peripheral as it requests more data.