0

I am controlling DC motor with Infineon BTN (mosfet) and STM32F103 MCU, What I am doing is increasing PWM DC from 0 to 100 % in 10 secs, and after keep 100 % of DC. However 100 % DC is not 100% as you can see on scope there is a spike returning to 0 so by the design of TIM timer it is probably 99%. What I want is to switch the TIM output use for PWM into normal I/O to level 1 after 10 secs. I tried simply stop PWM and switchnig I/O but it does not work any help appreciated.

Rgds

  • Pin mode should be changed from `alternate output` back to `gpio output`. See RM, `GPIOx_CRL`/`GPIOxCRH` description. – ReAl Sep 15 '18 at 16:51
  • it seems to work but does it needs to go back to AF before restarting PWM ? – Delphes Sep 16 '18 at 15:44
  • Yes, it needs to set AF mode before restarting PWM. – ReAl Sep 16 '18 at 15:46
  • In my case some complex waveform was generated with output compare mode. For constant '0' and '1' I switched output to GPIO PP and swithed to AF before starting waveform. – ReAl Sep 16 '18 at 15:48
  • It is perfect I tried and see scope signal so no more spike of course. Many Thanks – Delphes Sep 16 '18 at 15:52

0 Answers0