cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F051_discovery_kit_PWM_waveshape

service
Associate
Posted on March 15, 2014 at 06:33

Respected Sir,

                      I am new and dont have much exposure to ST microcontrollers and i am planning to use STM32F051 microcontroller in one of my projects,the project requires me to generate with a square waveform having a waveshape as shown in the attached .bmp file and with frequency ranging from 200Khz to 800Khz with duty cycle varying from 1% to 50%, the highest frequency that can be generated by me using the timer interrupts and GPIO toggling technique is 155Khz,while using the PWM module i can generate the frequency but cant match the waveshape,please guide me on this issue,Any Help and pointers is highly appreciated.

Thanks and Regards,

Girish
1 REPLY 1
Posted on March 15, 2014 at 13:34

Well you're going to want to avoid interrupts in >100KHz range, as the processor is going to saturate.

If you needed 50/50 duty you could generate two phase shifted signals from a single timer. This can be done with Toogle mode, and inferring phase with different TIMX->CCRx offsets. ie a Quadrature output.

Your example probably needs two timers, with the phase relationship set using different TIMx->CNT values. You might be able to use some slave mode settings to do this, but you're going to have to read and understand the documentation.

You might also be able to use TIM->DMA->GPIO to drive pins with a pattern buffer too.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..