Does etpu_app_pmsmesvc3 Permanent Magnet Synchronous Motor Vector Control (AN3206) work?

Showing results for 
Search instead for 
Did you mean: 

Does etpu_app_pmsmesvc3 Permanent Magnet Synchronous Motor Vector Control (AN3206) work?

Contributor III

I received the application note source code from Freescale.  It's "pmsmesvc2_CW2.3":

This is release 1.1 of the demo application

PMSM Vector Control, Driven by eTPU on MPC5500


However, the call to fs_etpu_bc_init() in fs_etpu_app_pmsmesvc3_init() is internally inconsistent.  It passes 0xFFFFFE and 0xFFFFFF as the bus ON and bus OFF parameters:


    err_code = fs_etpu_bc_init(

        BC_channel,                                                                 /* channel */

        FS_ETPU_PRIORITY_LOW,                                                       /* priority */

        BC_mode,                                                                    /* mode */

        BC_polarity,                                                                /* polarity */

        2 * (etpu_tcr1_freq / PWM_freq_hz),                                         /* period */

        0,                                                                          /* start_offset */

        0,                                                                          /* services_per_irq */

        0xFFFFFE,                                                                   /* u_dc_bus_ON */

        0xFFFFFF                                                                    /* u_dc_bus_OFF */


These parameters are ufract24_t types (that is, uint32_t in etpu_util.h).  In fs_etpu_bc_init() it checks that u_dc_bus_ON is greater than or equal to u_dc_bus_OFF and returns an error.  So  it is returning this error:


    * Parameters bounds check.















This is using RTEMS 4.11 and the "phycore_mpc5554" board support package using GCC, but I've been using this just fine controlling six axis of DC motors for a few years now.  That means I haven't tested this using FreeMaster and the Freescale development board set.


Does anyone know what's up here?  Does this version of the application work?

Labels (1)
0 Kudos
3 Replies

NXP Employee
NXP Employee

Hi Peter,

at first, if you don't include #define FS_ETPU_MC_PARAM_CHECK in your project, it will not end up with the error, because the parameter value check will simply not be in place.

Anyway, the values of u_dc_bus_ON and u_dc_bus_OFF are not correct, that's true. And they are probably set so to disable the operation DC Bus Break eTPU function at all.

If you know what u_dc_bus_ON/OFF thresholds should be set for your hardware setup, put the values in and all these issues will disappear.

Good luck!

0 Kudos

Contributor III

I'm now actively trying to get this working and I see another issue with this code.  If you have time, see my issue in the In AN3206 "PMSM vector control..." how can u_ab be {0, 0} and u_dq {non_zero, 0} in align_start state? thread.

0 Kudos

Contributor III

I think the intent is to do a partial initialization at this point and finalize the initialization in fs_etpu_app_pmsmesvc3_calib_finish() where it calls fs_etpu_bc_set_thresholds().  I don't want to disable the compile-time parameter checking, since that's how I've been using it up to now, so I'll figure out a change as a work-around.

I actually asked this question because of a stupid bug in my software that crashed things after I disabled the parameter check, allowing the program to continue, and that got me wondering if the version I'd been sent by Freescale was OK.  As soon as I hooked up the debugger I saw my bug.  I should have done that first.

I have another question but I'll start a new thread.

0 Kudos