cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX generated DMA code

jminack
Associate II

Hi,

I'm using V6.15.0 of CubeMX with STM32U5 to generate DMA code. When I use the following configuration, it appears to generate incorrect code?

jminack_0-1755478887628.png

I've noticed the following:

1) It placed the Node_GPDMA1_Channel1 structure on the stack:

jminack_1-1755479106077.png

This doesn't seem right, and I would note that when memory to memory DMA is selected, it allocates this (correctly) statically.

2) It sets the source increment mode to LL_DMA_SRC_FIXED:

jminack_2-1755479311613.png

 

This again doesn't seem right. When transferring from memory to peripheral, the source increment mode should be LL_DMA_SRC_INCREMENT.

 

3) This code is confusing and inconsistent:

 

jminack_3-1755480360402.png

When generating memory to memory code, the LL_DMA_SetLinkedListBaseAddr call is placed inside the comments. When generating peripheral to memory code, it is placed outside of the comments.

 

Regards

 

John

 

3 REPLIES 3
Ghofrane GSOURI
ST Employee

Hello @jminack 

I'm currently investigating this.

I will get back to you asap.

THX
GHofrane

 

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.

Ghofrane GSOURI
ST Employee

Hello @jminack 

Thank you very much for your valuable contribution.

Regarding the first issue: Ticket 215856 has been escalated to the development team for resolution.

Regarding the second issue: Ticket 215855 has also been submitted to the development team for further investigation.

Regarding the third point: Could you please provide more details or clarify your concern so I can better assist you?

THX

Ghofrane

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.

jminack
Associate II

Hi @Ghofrane GSOURI ,

Thanks for your quick response. With regards to item 3, when code is generated as per the configuration above (so, Peripheral to Memory), the following code is inserted:

  /* Next function call is commented because it will not compile as is. The Node structure address has to be cast to an unsigned int (uint32_t)pNode_DMAxCHy */
  /*

  */
  LL_DMA_SetLinkedListBaseAddr(GPDMA1, LL_DMA_CHANNEL_1, (uint32_t)&Node_GPDMA1_Channel1);

Notice the empty comments on line 2 to line 4. The comment itself doesn't make sense. 

When the code is generated with Memory to Memory however, you get this:

  /* Next function call is commented because it will not compile as is. The Node structure address has to be cast to an unsigned int (uint32_t)pNode_DMAxCHy */
  /*

  LL_DMA_SetLinkedListBaseAddr(GPDMA1, LL_DMA_CHANNEL_1, (uint32_t)&Node_GPDMA1_Channel1);

  */

So the issue I'm raising is:

1) Why the difference behavior for Memory to Memory and Peripheral to Memory

2) The comment in the first case doesn't make any sense, as nothing is commented out.

3) It's unclear why the comment say the code will not compile as is? Is it is referring to the call to  LL_DMA_SetLinkedListBaseAddr? If it is, what is the issue with compiling in that code?

 

Thanks again.

 

John