cancel
Showing results for 
Search instead for 
Did you mean: 

How to read status of PWM pin accurately ?

KShah.6
Associate II

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.

5 REPLIES 5
Uwe Bonnes
Principal III

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

S.Ma
Principal

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.

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.

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

we dont need to firmware by ourselves, lets talk

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?