cancel
Showing results for 
Search instead for 
Did you mean: 

Software PWM, best approach?

Javier1
Principal

It finally happened, i need two pins without pwm functionality to output pwm signals (minimum 1kHz)

Im using an STM32f072R8Tx clocked with HSI48Mhz, my TIM1 is available.

0693W00000BbfhsQAB.pngMy idea is:

TIM1 channels 1 and 2 set up as PWM NO OUTPUT with interruption enabled, discriminate the source of the interruption (channel).

Toggle the corresponding GPIOs inside the IRQ function.

Is there another magical way that doesnt interrupt my programm every milisecond?

we dont need to firmware by ourselves, lets talk
12 REPLIES 12

<<Disregard>>

@AFran.7​ You had an interesting point, why did you redacted your own comment?

Im still learning the ways in which gcc chews my code

we dont need to firmware by ourselves, lets talk

I've been struggling to get this working. Whenever I increase the pwm buffer size > 4, my I2C DMA process stops working correctly and no longer produces an interrupt on completion.

I had originally thought that I had fixed the problem as above, but turns out my hypothesis was incorrect.

As of yet I cannot get the different DMA channels to play nice with each other.

 Edit:

I think I figured it out, I had the DMA going in the wrong direction