1
\$\begingroup\$

I am making a full bridge control on D-SMPS and I want to trigger PWM from ADC to keep output voltage constantly stable. I am using STM32f103xx as microcontroller. The problem is that looks like in ST's MCUs does not provide a trigger for PWM from ADC. So how can find the right path?

\$\endgroup\$
  • \$\begingroup\$ To trigger ADC from PWM. But it is not clear what your intentions are. \$\endgroup\$ – Marko Buršič Aug 27 at 8:31
  • \$\begingroup\$ Could you explain the bit about trigger PWM from ADC? What should happen with the PWM at the end of conversion? \$\endgroup\$ – berendi Aug 27 at 8:32
  • \$\begingroup\$ I want to change pwm duty cycle after measuring output voltage , so to do it fast at the end of conversion of ADC ıt should gives a trigger so that pwm duty cycle is rearranged depending on adc value. \$\endgroup\$ – emre iris Aug 27 at 8:45
  • \$\begingroup\$ how are you reading the voltage? is it time triggered? \$\endgroup\$ – Pop24 Aug 27 at 8:47
  • \$\begingroup\$ I understand what you want to do and can guess at why. But your question has far too little detail for anyone to construct a useful or meaningful answer. Please edit your question and greatly improve it, showing your work and findings so far in considerable detail with any schematic. The better the quality of your question, the better the quality of the answers you will attract. \$\endgroup\$ – TonyM Aug 27 at 8:55
2
\$\begingroup\$

I want to change pwm duty cycle after measuring output voltage

ST's timers have buffered register options, they call it preload. They will update at an overflow.
You can safely write directly to the compare registers from where you have your ADC computation result as long as in TIMx_CCMRx the bit OCxPE is set.

\$\endgroup\$
1
\$\begingroup\$

Enable the end of conversion interrupt for the ADC in the ADC_SR Register (page 237 of reference manual RM0008). Once you have a new ADC measurement this will trigger this interrupt and you can access the ADC value (in the ADC_DR Register) immediately after the trigger and use this to update your PWM duty cycle as required.

\$\endgroup\$
0
\$\begingroup\$
  • Start ADC conversion
  • enable ADC Interrupt
  • update PWM in ADC ISR (when conversion ready)
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.