Skip to main content
Associate III
December 24, 2024
Solved

CubeMX not generating all needed DMA_HandleType inits when Circular SPI transfer is selected?

  • December 24, 2024
  • 1 reply
  • 1629 views

Using STM32H533RE and successfully got SPI1 doing DMA transfers with HAL_SPI_Transmit_DMA() one shot at a time. As soon as I select Circular transfer and re-gen, the above function fails because a bunch of fields in my 

DMA_HandleType for that DMA channel are left at 0. I get a bunch of NEW inits for the 
DMA_NodeConfTypeDef. I decided to cut and paste the handful of items from the old HAL_SPI_MspInit() when in non-circular mode, and paste them into the circular config re-generated HAL_SPI_MspInit() and voila DMA SPI in circular mode works fine. 
 
Is this a cube MX bug? Or am I missing something?
 
See attached screenshots
Best answer by Ghofrane GSOURI

Hello @devinw 

I appreciate your contribution.

A ticket  182039 has been raised to dev team to fix this issue . 

As a simple  workaround , try to add the following line of code 

 

handle_GPDMA1_Channel4.Init = NodeConfig.Init;

 

 Here 

 handle_GPDMA1_Channel4.Instance = GPDMA1_Channel4;

 handle_GPDMA1_Channel4.InitLinkedList.Priority = DMA_LOW_PRIORITY_HIGH_WEIGHT;

 handle_GPDMA1_Channel4.InitLinkedList.LinkStepMode = DMA_LSM_FULL_EXECUTION;

 handle_GPDMA1_Channel4.InitLinkedList.LinkAllocatedPort = DMA_LINK_ALLOCATED_PORT0;

 handle_GPDMA1_Channel4.InitLinkedList.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;

 handle_GPDMA1_Channel4.InitLinkedList.LinkedListMode = DMA_LINKEDLIST_CIRCULAR;

if (HAL_DMAEx_List_Init(&handle_GPDMA1_Channel4) != HAL_OK)

 {

 Error_Handler();

 }



if (HAL_DMAEx_List_LinkQ(&handle_GPDMA1_Channel4, &List_GPDMA1_Channel4) != HAL_OK)

 {

 Error_Handler();

 }



 __HAL_LINKDMA(hspi, hdmatx, handle_GPDMA1_Channel4);



if (HAL_DMA_ConfigChannelAttributes(&handle_GPDMA1_Channel4, DMA_CHANNEL_NPRIV) != HAL_OK)

 {

 Error_Handler();

 }



/* SPI1 interrupt Init */

 HAL_NVIC_SetPriority(SPI1_IRQn, 0, 0);

 HAL_NVIC_EnableIRQ(SPI1_IRQn);

/* USER CODE BEGIN SPI1_MspInit 1 */

 handle_GPDMA1_Channel4.Init = NodeConfig.Init;

/* USER CODE END SPI1_MspInit 1 */

 }

1 reply

Ghofrane GSOURI
Technical Moderator
December 24, 2024

Hello @devinw 

First let me thank you for posting.

I would appreciate it if you could share your IOC so that I can verify your configuration.

I will be waiting for your feedback.

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.
devinwAuthor
Associate III
December 24, 2024

Thanks Ghofrane. IOC file is attached!

Ghofrane GSOURI
Technical Moderator
December 26, 2024

Hello @devinw 

Could you please try to use the latest version of CubeMX 6.13.0 .It could help you solve the issue .

I will be waiting for your feedback.

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.