2022-01-06 5:50 PM
Hi,
I am trying to figure out to make HRTIM burst DMA working. I want to update timer period, compare1, compare2, and compare 3 registers by using burst DMA. There is not much information about this. There are two postings in the community posted several years ago, and it gave me some idea. But I need to have more information.
Below screenshots and code are used for the configuration.
I am not sure that I need to check on the "Increment Address" or not.
InvPerComp[0] = new_per; // new period
InvPerComp[1] = cmp1; // new compare 1
InvPerComp[2] = cmp2; // new compare 2
InvPerComp[3] = cmp3; // new compare 3
// Will this update the registers in order?
HAL_HRTIM_BurstDMATransfer(hrtim, timer, (uint32_t)&InvPerComp[0], 4)
2022-03-03 3:07 AM
Did you find a solution to this problem? It would be interesting to know as I'm working on a similar problem.
2023-11-14 7:03 AM
Did you find a solution to this problem? I have a similar problem.
2023-12-19 8:55 AM
Hello @JRyu.1 , @BKain.2 , @MTall.3 ,
Here some support and points that may help you :
Best Regards,
Pierre
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.
2023-12-19 9:48 AM
Confirm that the source buffer used for DMA holds the correct data in the correct order for updating the timer period, compare1, compare2, and compare3 registers.
2025-07-25 2:24 AM
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