2025-07-25 2:24 AM - last edited on 2025-08-15 8:43 AM by Amel NASRI
I am also failing in reproducing the DMA example from https://wiki.st.com/stm32mcu/wiki/Getting_started_with_HRTIM#To_go_further_about_DMA_burst.
HAL_HRTIM_BurstDMAConfig() is mentioned in the text, but not present in the code example. Did you miss to put it into the example?
Minor issue: I find it weird to edit HAL_HRTIM_MspInit() to change DMA_MEMORY_TO_PERIPH to DMA_MEMORY_TO_MEMORY as this gets overwritten by the next code generation.
Would it be safe to put this in the user section below:
/* USER CODE BEGIN HRTIM1_MspInit 1 */
hdma_hrtim1_a.Init.Direction = DMA_MEMORY_TO_MEMORY;
if (HAL_DMA_Init(&hdma_hrtim1_a) != HAL_OK)
{
Error_Handler();
}
/* USER CODE END HRTIM1_MspInit 1 */
This would result calling HAL_DMA_Init() twice. Is this OK?
Kind regards,
Guido
2025-07-25 3:19 AM
Sorry, I was wrong. HAL_HRTIM_BurstDMAConfig() is called in the autogenerated MX_HRTIM1_Init().
2025-07-25 7:38 AM
What I would like to achieve in the end is a running HRTIM1 where the MPER register gets updated with every period. I assumed this can be achieved with burst DMA.
The example from https://wiki.st.com/stm32mcu/wiki/Getting_started_with_HRTIM#To_go_further_about_DMA_burst is the only one, I could find.
In order to learn more about burst DMA, I started experimenting. First, I wanted to update multiple registers.
I am writing to the four CMP registers and preset them with different values to visualize it better:
static uint32_t reg_update[] = {
0xaaaa,
0xbbbb,
0xcccc,
0xdddd,
};
static inline void BurstDMA_Test(void)
{
HAL_StatusTypeDef ret;
HRTIM1->sTimerxRegs[HRTIM_TIMERINDEX_TIMER_A].CMP1xR = 0x11;
HRTIM1->sTimerxRegs[HRTIM_TIMERINDEX_TIMER_A].CMP2xR = 0x22;
HRTIM1->sTimerxRegs[HRTIM_TIMERINDEX_TIMER_A].CMP3xR = 0x33;
HRTIM1->sTimerxRegs[HRTIM_TIMERINDEX_TIMER_A].CMP4xR = 0x44;
ret = HAL_HRTIM_BurstDMATransfer(
&hhrtim1, HRTIM_TIMERINDEX_TIMER_A, (uint32_t)reg_update, 4);
if (ret != HAL_OK)
{
Error_Handler();
}
}
But that just gave me:
So, the first value is copied into all the configure registers.
OK, so maybe I have to set the "Increment Address" for the DMA configuration:
But this results in only one register being updated:
I am puzzled!
So, my first piece in understanding would be: How to update multiple registers from a single buffer.
Kind regards,
Guido
2025-08-15 10:05 AM
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Regards,
Christian