You are here

How to interpret the result of "last_adc_duration" (terminal command)?

5 posts / 0 new
Last post
RSR
Offline
Last seen: 5 months 3 weeks ago
VESC Original
Joined: 2017-05-24 12:46
Posts: 38
How to interpret the result of "last_adc_duration" (terminal command)?

It reports e.g.:  "Latest injected ADC duration: 0.0253 ms". 

FOC 20kHz PWM, and sampling in vectors V0 and V7, means interrupts come at 40kHz, right? 

         40*0.0253 > 1    

Does that mean interrupt overload/overrun and that I should reduce PWM freq?    How to detect overload?

By the way: RT-app works only sometimes...  can that be related to MCU overload?

benjamin
Offline
Last seen: 12 hours 39 min ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490
At 20 kHz the sampling frequency is 10 kHz when sampling in V0 only, and 20 kHz when sampling in v0 and v7. So at 20 kHz the CPU load is around 25 % when sampling in v0 only and 50 % when sampling in V0 and V7.
RSR
Offline
Last seen: 5 months 3 weeks ago
VESC Original
Joined: 2017-05-24 12:46
Posts: 38

Maybe there are different definitions of FOC PWM frequency and PWM period?  

I had expected something like Freq = 1/T, where T=PWM period as shown in fig 6 page 5: https://www.eal.ei.tum.de/fileadmin/tueieal/www/courses/PE/tutorial/2013...

When connecting an oscilloscope between GND and a motor terminal, then I would expect to see the PWM frequency, not PWM/2.

benjamin
Offline
Last seen: 12 hours 39 min ago
VESC FreeVESC OriginalVESC Platinum
Joined: 2016-12-26 15:20
Posts: 490

The point of svm is that you effectively double the switching frequency that the motor sees for a given amount of switching. Running three independent "normal" modulated channels at 20 kHz will give the same current ripple that the motor sees when running svm with a center aligned timer base frequency of 10 kHz. The timer will cycle through all vectors both when upcoming and when downcounting.

You can have a look around 32:20 in this video to see roughly how it works:

RSR
Offline
Last seen: 5 months 3 weeks ago
VESC Original
Joined: 2017-05-24 12:46
Posts: 38

Thank you for explaining.  I know SVM and I agree with what you say in your video, but note that your definition of SVM frequency deviates, by a factor 2, from (all?) textbooks.  I made a similar simulation model in another millennium.   The "effectively double" frequency is valid when modulation index is low, but I think the doubling can also be absent -- for example: consider the voltage between two motor terminals when modulation index is high and output voltage vector is middle between two of the primary vectors.

Result at mod index = 1  (almost same at 0.95, max used in VESC?):

  • 1st motor terminal will stay at GND
  • 2nd will stay at Vbat
  • 3rd: 50% of time at GND and 50% at Vbat, at same frequency as the base counter (i.e. no doubling)

This example is probably not relevant for your capacitor calc, but it might be relevant for audible noise.