cancel
Showing results for 
Search instead for 
Did you mean: 

TIM1 with DMA burst mode and circular transfer

Frank_P
Associate

Hello,

is there an application example how to configure TIM1 in DMA burst mode and circular transfer? I need asymmetric PWM for 3 phases with dead time insertion... 

Best regards,

5 REPLIES 5
waclawek.jan
Super User

Thank you!
But in the example the circular transfer is missing...
Do I need to configure the DMA transfer in linked-list mode? Or should I restart the DMA Burst in the DMA interrupt when the Transfer Complete flag is set?

Best regards,

Frank

 

Hello,

Refering to RM0522, p.415, Section 14.4.13, the circular mode for LPDMA of C5 series goes through the linked list programming (ST, please create an application note specifically for the LPDMA of C5, or is there another family that would have the same LPDMA peripheral).

 

Best regards.

Saket_Om
ST Employee

Hello @Frank_P 

To perform a circular transfer, you should use the linked-list of the DMA.

In MX2, you can select CIRCULAR transfer in the DMA configuration on top of the DMA burst configuration in TIM side.
With HAL, you can use HAL_DMA_SetConfigPeriphLinkedListCircularXfer() for the DMA configuration and for the DMA burst configuration in TIM side, HAL_TIM_SetConfigDMABurst(), then the HAL_TIM_StartDMABurst() calls the HAL_DMA_StartPeriphXfer_IT_Opt() function that depending on the previous DMA configuration starts the DMA transfer in DIRECT or CIRCULAR.
So depending, the TIM event you are using in the DMA burst configuration (in TIM side), the DMA burst transfers will be performed circularly on this event.

You can use the existing TIM example hal_tim_pwm_dma_burst and adapt it with the circular mode.

The only thing you should care about is that there is a configuration of a DMA burst length in the TIM DMA burst configuration when calling HAL_TIM_SetConfigDMABurst() and a DMA transfer size (size_byte) when calling HAL_TIM_StartDMABurst().

In the current example, because the DMA burst length is 3 and the number of data to transfer is 6 (in DMA), the CCRx registers will be updated twice.

So, with the circular mode, depending on your buffer, you should adapt the DMA burst length and the DMA transfer size. 

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.
Saket_Om

Hi @Kraal 


ST, please create an application note specifically for the LPDMA of C5, or is there another family that would have the same LPDMA peripheral

There is an application note about LPDMA: AN6457. It provides detailed guidelines and recommendations for using LPDMA in STM32C5 series, focusing on performance optimization and efficient data transfer.

-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.