Showing results for 
Search instead for 
Did you mean: 

How to use DMA to change PWM frequency?

Associate II

Hi! I know overall idea of DMA and i need to use it but i have no idea how to do it.

I found one post with same question but i didn't found any helpful info for me. I'm not advanced in case of using registers. I used them to directly change CCR and ARR sometimes, so I need a direct answer.

Edit: It is worth mentioning that I use CubeIDE

Thanks for help

Associate II

It turned out that i don't need DMA at all. I thought I needed because weird things were happening when i was updating ARR directly with TIMx->ARR = y. It turned out that I was doing that when counter was waaay beyond my y value. I just added line to reset CNT value and everything works like a charm.

Look at my first reply:

> Make sure ARR preload is switched on.

Read the TIM chapter. ARR preload is switched on by setting TIMx_CR1.ARPE.