I try to implement the Center-Aligned PWM on an STM32F410 and the current measurement triggers from the PWM generation timer. I have some trouble in finding the right measurement point for my currents, because somehow I'm never able to get all three phase currents in full resolution. The Center-Aligned PWM works fine as this image shows:
(UV-Phases Center Aligned PWM) UV-Phases Center Aligned PWM
I first tried to synchronize the measurement when all low side MOSFETs are open, since this makes the most sense to me, because I measure at the low sides. This is the result:
(Low Side Currents UVW in RGB) Low Side Currents UVW in RGB (Osci Triggering Measurement in Blue) Osci Triggering Measurement in Blue
From the V Phase, I always get only half the wave correct. It has nothing to do with saturation, the driver is able to measure up to 7A per phase, where here is only around 700mA applied. Also the ADC goes not in any saturation at all.
Then I tried to measure when all the high side MOSFETs are on, but this is even worse, but expected:
(HIGH Side MOSFETS ON) HIGH Side MOSFETS ON (Osci High Side Triggering Measurement in Blue) Osci High Side Triggering Measurement
Here can be seen, that the V-phase is measured correct, but this time U and W have only half the resolution.
Has any one an idea what is wrong here, that I cannot measure the currents of all three phases? The Center-Aligned PWM works fine as the first image shows, so all phases are centered correctly. Also the measurement triggering is perfectly synchronized. Do I need to measure at a different point?
**Edit: ** A solution I just found is to assume Iv = -(Iu + Iw), this seems to work pretty good. Is it possible, that not all three phase currents can be measured simultaneous?
1 Answer 1
Yes, STM32F410 cannot measure multiple voltages at once. It only has one ADC and the channels are merely multiplexed. If you are set on an STM32 you need one with an ADC for each simultaneous measurement (typically up to 3, more on STM32F3).
As talked about in the comments: another issue was sampling time. OP set the sampling time to 480 cycles at a 25 MHz clock which is 19,2us - that's too long for this application.
-
\$\begingroup\$ Hmm ok, i need an STM32F4, since i need the 16kByte flash pages. Also if it does not measure all the channels simultaneous, the multiplexing approach (sequential?) should also work, since there is plenty of available time for the measurement as shown from the graphs above and the V-phase is measured before the W-phase, so I don't understand why the W-phase can be measured correct, but not the V-phase. \$\endgroup\$HansPeterLoft– HansPeterLoft2018年09月15日 09:32:20 +00:00Commented Sep 15, 2018 at 9:32
-
\$\begingroup\$ @HansPeterLoft be careful with timings - a lot depends on the impedance of your source, in the manual there are equations on the minimum sampling versus source impedance. A single measurement can take up to 240us \$\endgroup\$jaskij– jaskij2018年09月15日 09:36:07 +00:00Commented Sep 15, 2018 at 9:36
-
\$\begingroup\$ Hmm ok, that could indeed be the problem. The sources are the internal differential amplifiers of the DRV8304H gate driver ic and I sample with 480 cycles sampling time, where the ADC runs at 25Mhz, that is for 3 channels around 58us. \$\endgroup\$HansPeterLoft– HansPeterLoft2018年09月15日 10:53:33 +00:00Commented Sep 15, 2018 at 10:53
-
\$\begingroup\$ @HansPeterLoft that's 20us by my count. 480 / 26e6 \$\endgroup\$jaskij– jaskij2018年09月15日 10:55:51 +00:00Commented Sep 15, 2018 at 10:55
-
1\$\begingroup\$ I changed it to 28cycles, now it works perfectly. Thank you, I didnt thought about that. \$\endgroup\$HansPeterLoft– HansPeterLoft2018年09月15日 11:17:19 +00:00Commented Sep 15, 2018 at 11:17