Skip to main content
DNguy.11
Associate
November 12, 2021
Question

__HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__)

  • November 12, 2021
  • 3 replies
  • 3830 views

I am using STM32F427ZIT6 with both USART1 and USART3. Both USART ports are DMA enable. I use STM32CubeMX version 6.2.1 to generate the code.

My problem is when USART3 is not transmitted, USART1 communication works as expected.

When USART3 is transmitted, USART1 data is corrupted. My question is

  __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart1_tx);

  __HAL_LINKDMA(uartHandle,hdmatx,hdma_usart3_tx);

Would the same hdmatx cause my problems?

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
November 12, 2021

Presumably uartHandle would actually need to be USART/UART UNIQUE, it is an instance for carrying around related data.

And yes more generally you can't share DMA resources, there's a table in the Reference Manual, and you need to pick resources/options which don't conflict with each other.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
TDK
November 12, 2021

It's not the same hdmatx. One is huart1.hdmatx and one is huart3.hdmatx. I can't see that being the problem.

#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
 do{ \
 (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
 (__DMA_HANDLE__).Parent = (__HANDLE__); \
 } while(0U)

If data is sent (even if it is corrupted) it suggests the DMA part is working.

"If you feel a post has answered your question, please click ""Accept as Solution""."
DNguy.11
DNguy.11Author
Associate
November 12, 2021

In HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) from attached code. Line 155 and 218 reference to hdmatx?

DNguy.11
DNguy.11Author
Associate
November 12, 2021

Thank you so much for your quick response. Would you fix in the next version STM32CubeMX generate code?