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.
**************************************/
#ifdef FS_ETPU_MC_PARAM_CHECK
if(((channel>31)&&(channel<64))||(channel>95)||
(priority>FS_ETPU_PRIORITY_HIGH)||
((mode!=FS_ETPU_BC_SLAVE_ON_OFF)&&(mode!=FS_ETPU_BC_SLAVE_PWM)&&
(mode!=FS_ETPU_BC_MASTER_ON_OFF))||
(polarity>ETPU_BC_ON_LOW)||
(period>0x800000)||
(start_offset>0x800000)||
(u_dc_bus_ON<u_dc_bus_OFF))
{
return(FS_ETPU_ERROR_VALUE);
}
#endif
This is using RTEMS 4.11 and the "phycore_mpc5554" board support package using GCC 4.8.2.3, 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?