Coder Social home page Coder Social logo

Comments (6)

pattacini avatar pattacini commented on August 19, 2024 3

Interesting timing for a comparison:

image

Source: https://www.mathworks.com/campaigns/offers/next/field-oriented-control-techniques-white-paper.html

Note

We're not that bad, after all!

cc @marcoaccame @sgiraz @mfussi66 @Nicogene @maggia80

from icub-firmware-models.

sgiraz avatar sgiraz commented on August 19, 2024 2

➡️ On AMCBLDC

In point 2 I want to remark that the $8.3$ $\mu s$ are taken to execute the AMC_BLDC_step_FOC() function when the control mode is IDLE.
When the control mode is set to CURRENT instead, it takes $10.7$ $\mu s$, see the scope plot below:

TEK00004

I Apologize for the mistake/confusion!

By the way, the EventViewer shows that the whole DMA interrupt takes about $15$ $\mu s$ :

Screenshot 2024-02-07 163653

Measuring with the scope we got $13.1$ $\mu s$ measuring the whole onCurrents_FOC_innerloop function:

TEK00005

...And $14.34$ $\mu s$ considering the whole DMA:

TEK00006

static void adc2_HalfTransferComplete_cb(ADC_HandleTypeDef *hadc)
{
    // TODO: start measuring from here
    
    GPIOB->BSRR = (uint32_t)0x0020; // 0x0004

    
#if defined(MOTORHAL_changes) 
    rawCph1 = adc2_Buffer[0].cph1;
    rawCph2 = adc2_Buffer[0].cph2;
    rawCph3 = adc2_Buffer[0].cph3;
    pwmSetCurrents_cb(rawCph1, rawCph2, rawCph3);
#if !defined(MOTORHALCONFIG_DONTUSE_RUNTIMECURR_FILTERING)
    analogMovingAverageFromISR(&cph1Filter, rawCph1); 
    analogMovingAverageFromISR(&cph2Filter, rawCph2);
    analogMovingAverageFromISR(&cph3Filter, rawCph3);   
    

#endif    
#else
    rawCph1 = adc2_Buffer[0].cph1;
    rawCph2 = adc2_Buffer[0].cph2;
    rawCph3 = adc2_Buffer[0].cph3;
    pwmSetCurrents_cb(rawCph1, rawCph2, rawCph3);
    analogMovingAverageFromISR(&cph1Filter, rawCph1);
    analogMovingAverageFromISR(&cph2Filter, rawCph2);
    analogMovingAverageFromISR(&cph3Filter, rawCph3);
#endif

    GPIOB->BRR = (uint32_t)0x0020; // 0x0004
}

In summary (when in CURRENT control mode):

AMC_BLDC_step_FOC() function $10.7$ $\mu s$
onCurrents_FOC_innerloop function $13.1$ $\mu s$
the whole DMA $14.34$ $\mu s$

cc @Nicogene @pattacini @marcoaccame @mfussi66

from icub-firmware-models.

sgiraz avatar sgiraz commented on August 19, 2024 2

➡️ AMC2C (66.6 KHz)

When the control mode is set to CURRENT instead, the AMC_BLDC_step_FOC() function takes $20$ $\mu s$, see the scope plot below:

TEK00007

The the whole onCurrents_FOC_innerloop function takes $25.45$ $\mu s$:

TEK00008

The whole DMA takes $26.86$ $\mu s$:

TEK00009

With the EventViewer we got about $29$ $\mu s$ :

Screenshot 2024-02-08 111525

In summary (when in CURRENT control mode):

AMC_BLDC_step_FOC() function $20$ $\mu s$
onCurrents_FOC_innerloop function $25.45$ $\mu s$
the whole DMA $26.86$ $\mu s$

cc @pattacini @marcoaccame @maggia80 @Nicogene

from icub-firmware-models.

Nicogene avatar Nicogene commented on August 19, 2024 2

Great analysis @sgiraz !

To summarize we have

AMC2C (66.6 KHz) AMCBLDC
AMC_BLDC_step_FOC() function $20$ $\mu s$ $10.7$ $\mu s$
onCurrents_FOC_innerloop function $25.45$ $\mu s$ $13.1$ $\mu s$
the whole DMA $26.86$ $\mu s$ $14.34$ $\mu s$

"Why is AMC2C slower than AMCBLDC?" We know this is an ongoing study and we're probably at the right point to contact ST.

A ~ 2x factor seems a lot, maybe it is the case of contacting ST

from icub-firmware-models.

Nicogene avatar Nicogene commented on August 19, 2024 2

The analysis of @sgiraz pointed out an important timing issue on amc2c, and this will be further investigate contacting ST, after that we hopefully know how to align the performance of the two boards.

Closing.

from icub-firmware-models.

Nicogene avatar Nicogene commented on August 19, 2024

This task has to be done after harmonizing Ts_FOC between the 2 boards.

from icub-firmware-models.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.