2024-12-23 08:34 PM
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
Solved! Go to Solution.
2024-12-26 11:28 PM - edited 2024-12-26 11:40 PM
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 */
}
2024-12-24 12:05 AM - edited 2024-12-24 01:56 AM
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
2024-12-24 10:18 AM
2024-12-26 04:47 AM
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
2024-12-26 10:57 AM
Hi Ghofrane, I updated to MX 6.13.0, which actually also updated my H5 FW from 1.2.0 to 1.4.0 and migrated the project for the new FW but the problem still persists. My SPI MSP init is missing all this:
Need but missing:
Generated OK by MX:
2024-12-26 11:00 AM
I should note, I also get these parameters, which look similar to the stuff I'm missing, BUT HAL_SPITransmitDMA() does not seem to know to look to the "node" type struct to get the info. It's always looking in the regular DMA_HandleType.
2024-12-26 11:28 PM - edited 2024-12-26 11:40 PM
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 */
}
2024-12-27 09:24 AM
Much appreciated!
And that is a smart idea to copy the init struct like that for the workaround. I will try this. That's a clean one-line solution :).
2024-12-30 10:30 AM
handle_GPDMA1_Channel4.Init = NodeConfig.Init
added to User code section of SPI NSP init function works great as a quick workaround. Thanks.