Skip to main content
Graduate
October 17, 2025
Solved

STM32G474 re-trigger HAL_TIM_DMABurst_MultiWriteStart() from sw

  • October 17, 2025
  • 1 reply
  • 335 views

Is it possible to re-trigger HAL_TIM_DMABurst_MultiWriteStart() from software? Currently it works only once (the first time) for me. Using TIM1 freq/duty-cycle:

HAL_TIM_DMABurst_MultiWriteStart(
 &htim1,
 TIM_DMABASE_ARR, // Base = ARR
 TIM_DMA_UPDATE, // Trigger = update event
 (uint32_t*)rampBurst, // Source buffer
 TIM_DMABURSTLENGTH_3TRANSFERS,// ARR + RCR + CCR1
 N_STEPS*3 // Number of bursts
);

__HAL_TIM_ENABLE_DMA(&htim1, TIM_DMA_UPDATE);

This produces a duty-cycle and frequency change over a certain amount of time, let's say 10ms, after the 10ms, I would like to disable the PWM output by setting the duty-cycle to 0:

__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, 0);

Then, I would like to re-trigger this each 100ms from software. My DMA setting is set to "Normal". The value of RCR is always 0 in the rampBurst array.

    This topic has been closed for replies.
    Best answer by Francois VILMAIN

    Hello, 
    Not sure it works but it might be worth trying this:

    Once the first transfer is completed (triggered by hw) update the DMA transfer descriptor then re-start the DMA transfer when needed.

    DMA descriptor update: replace DMA_REQUEST_TIM1_UP by DMA_REQUEST_MEM2MEM

    Re-start DMA transfer: call HAL_DMA_Start_IT(htim1->hdma[TIM_DMA_ID_CC1], (uint32_t)ramBurst,
    (uint32_t)&htim1->Instance->DMAR, DataLength)

    Hope this helps.

    1 reply

    ST Employee
    October 17, 2025

    Hello, 
    Not sure it works but it might be worth trying this:

    Once the first transfer is completed (triggered by hw) update the DMA transfer descriptor then re-start the DMA transfer when needed.

    DMA descriptor update: replace DMA_REQUEST_TIM1_UP by DMA_REQUEST_MEM2MEM

    Re-start DMA transfer: call HAL_DMA_Start_IT(htim1->hdma[TIM_DMA_ID_CC1], (uint32_t)ramBurst,
    (uint32_t)&htim1->Instance->DMAR, DataLength)

    Hope this helps.

    CyberNerdAuthor
    Graduate
    October 19, 2025

    Thanks, this works :)