2025-09-09 1:44 AM
I'm relatively new to STM32 and it's my first time working with DMA so this will probably be a very basic question.
I'm using STM32G474 and I want to have 3 channels of advanced timer TIM8 working in "PWM generation CHx CHxN" mode. At a later stage I'm looking to run FOC on them, but for now I just want to change the duty cycle of each channel period by period, by reading the duty cycle for the next period from a predefined table and transferring the duty cycle value using circular burst DMA to update all 3 channels at the same time without software overhead.
These are my DMA settings for TIM8 in the ioc file
I can't find the settings for which register i want to write to using DMA. I have ChatGPT telling me that DMA can only write to CCR register and Gemini telling me I can set which register to write to in the ioc. Both are pointing me to reference manual RM0440 (https://www.st.com/resource/en/reference_manual/dm00355726.pdf), but I'm getting overwhelmed there and can't find anything relevant in the DMA, DMAMUX or TIM8 chapters.
Basically:
- I'm looking to find out if i can change the register to be written to, as well as the burst length in the ioc file.
- If DMA is always writing to a set register for some peripheral where can I check what register that is?
- If it comes to it that it needs to be configured in the application code and not the ioc, what HAL function would I be using to start DMA in a circular, burst mode?
Thank you
Solved! Go to Solution.
2025-09-11 5:33 AM
Hi @Dor_RH
Unfortunately the TIM_DMABurst is not quite what I'm looking for. If I'm seeing right that project uses DMA in Normal mode, I'm looking to use it in Circular mode. I see that the example project uses HAL_TIM_DMABurst_WriteStart, same as me. In the comment above the function it says
* @note This function should be used only when BurstLength is equal to DMA data transfer length.
This lead me to believe I'm not using the right function, and I found HAL_TIM_DMABurst_MultiWriteStart, I set the corresponding data buffer length and started seeing the PWM outputs change the duty cycle for all 3 channels.
2025-09-09 6:58 AM
Hello @S-Bat,
Could you try the TIM_DMABurst example on the NUCLEO-G474RE: Link(here)
It contains an .ioc file that will be helpful for your application with DMA burst and to guide you.
I hope my answer has helped you. When your question is answered, please select this topic as the solution that answered you, as it will help others find that answer faster.
Thanks for your contribution.
Dor_RH
2025-09-11 5:33 AM
Hi @Dor_RH
Unfortunately the TIM_DMABurst is not quite what I'm looking for. If I'm seeing right that project uses DMA in Normal mode, I'm looking to use it in Circular mode. I see that the example project uses HAL_TIM_DMABurst_WriteStart, same as me. In the comment above the function it says
* @note This function should be used only when BurstLength is equal to DMA data transfer length.
This lead me to believe I'm not using the right function, and I found HAL_TIM_DMABurst_MultiWriteStart, I set the corresponding data buffer length and started seeing the PWM outputs change the duty cycle for all 3 channels.