cancel
Showing results for 
Search instead for 
Did you mean: 

4 Input PWM and 4 output PWM

csdominik
Associate III
Posted on November 14, 2011 at 01:36

The original post was too long to process during our migration. Please click on the attachment to read the original post.
2 REPLIES 2
Posted on November 14, 2011 at 03:28

      TIM_TimeBaseStructure.TIM_Prescaler = 1440 - 1;  // 72MHz/1440 = 50kHz

      TIM_TimeBaseStructure.TIM_Period = 1000 - 1; // 50KHz/1000 = 50 Hz

      TIM_TimeBaseStructure.TIM_ClockDivision = 0;

      TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;

      TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);

Then you can program the width between 0-1000 (20 us units), and the output frequency of PWM CH1-4 will be 50 Hz

You could used 144-1 and 10000-1, or 36-1 and 40000-1, if you need more fine grain control of the width.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
csdominik
Associate III
Posted on November 16, 2011 at 13:36

Thank you for suggestion about prescaler and period.

Due to problems with EXTI and STM32F1 I have decided to try STM32F4 uC  with have many more timers.

If someone have any solution orr suggestion for my problem with EXTI interrupts, please send me reply.