AnsweredAssumed Answered

Problem in  PWM  generation on timer output channel

Question asked by Rakesh Menon on Jul 2, 2017
Latest reply on Jul 3, 2017 by Rakesh Menon

Hello,

I recently migrated to STM32 Platform and I'm trying to learn all the Peripheral features without using Standard Peripheral Libraries. 

 

Problem Statement: 

I am not able to  get PWM output on  timer output channel 2 ( GPIOA1)  after configuring general purpose timer 2 of STM32F103c8T6 Micro-controller in PWM mode 2.

 

My Configuration:

 

Timer :              General Purpose timer 2

Timer Clock:     72 MHz

Duty cycle:        50%

Frequency:       50 Hz

MCU crystal :   8 MHz

 

I configured the GPIOA in Alternate function output Push Pull mode with maximum frequency not exceeding 50 MHz,  I connected an LED bulb to the GPIOA pin 1, but the LED wend on glowing without reduction in the brightness level. The LED was still glowing even after i performed a test with duty cycle set to 0. On the debugger window I could see exactly all the parameters I configured and the Count register was getting incremented. I cannot find information regarding selection of alternate functions for a GPIO Port.

 

I used  Keil Micro vision 4 IDE for compiling and debugging my source code, 

I read reference manual for register description and used steps from AN4013 Application note to develop source code

Kindly have a view of my source code and please notify me the corrections that need to be done. The target specifications are mentioned in the source code.

Thank you

 

 

.

Attachments

Outcomes