Skip to main content
KShah.6
Associate
November 19, 2022
Question

How to read status of PWM pin accurately ?

  • November 19, 2022
  • 5 replies
  • 1398 views

I am using STM32F407VG development board to implement Direct torque control with space vector modulation of induction motor drive. I want to read status of PWM pins accurately in order to estimate phase voltage from DC link voltage and status of the switched.

This topic has been closed for replies.

5 replies

Uwe Bonnes
Chief
November 19, 2022

You can read the present status of any non-analog pin with GPIOX->IDR.

KShah.6
KShah.6Author
Associate
November 22, 2022

Sir I have tried this but it shows on and off at one particular fixed duty. But actual PWM signals are of variable duty cycle.

can you please suggest how to sense PWM signal with variable duty cycle accurately?

S.Ma
Principal
November 21, 2022

Motor application typically use advanced timers, usually TIM1 or 8. Use channels 1,2,3 as input to free running timer. Edges can be captured, sometime dma saved directly in memory and containing timestamps.

KShah.6
KShah.6Author
Associate
November 21, 2022

Thank you for your reply.

Sir, I have tried the method you have suggested so far. I have used TIM2 in PWM input capture mode but problem is that sometimes I got the same results as that of PWM signal and same time I got inverted results.

Can you please suggest how to solve this issue.

Javier1
Principal
November 21, 2022

if i understood correctly, you are developing a sensorless motor driver.

->if youre trying to do Trapezoidal control a.k.a "voltage controlled", you'd need 2 Operational amplifiers and 2 ADC channels measuring 2 of your phase voltages(back EMF). (the third one is ortogonal so no need)

->if youre trying to implement FOC control a.k.a "current control", you will need 2 operational amplifiers and 2 ADC measuring 2 shunt resistors on 2 of your phases.

You need to time the ADC measurements to be taken just in between PWM cycles (back EMF)

or in the case of FOC, right at the peak of every PWM cycle

hit me up in https://www.linkedin.com/in/javiermuñoz/