MCRSP_ACIM_V1.2.0: changing M1_PWM_FREQ ?

Showing results for 
Search instead for 
Did you mean: 

MCRSP_ACIM_V1.2.0: changing M1_PWM_FREQ ?

Contributor I

Hi I'm developing a drive for large #ACIM & #PMSM.

We've successfully developed a tiny PMSM drive using #KV31 and KMS.

For this project were in the process for laying out a custom #KV58 CPU with all the bells and whistles.

In order to accelerate the development I've set up a mini version of the system using the aforementioned tiny KV31 drive using #MCRSP_ACIM_V1.2.0 since KV58 is not KMS enabled.

After modifying for my custom hardware everything runs perfectly until I try to change M1_PWM_FREQ. See below captured with M1_PWM_FREQ = 10kHz (default).


I first tried to reduce the frequency too 1kHz (the final application will require this) all control and identified parameters unchanged. 

* Clock & PWM definition
#define M1_PWM_FREQ (1000) /* PWM frequency - 10kHz */
#define M1_FOC_FREQ_VS_PWM_FREQ (1) /* FOC calculation is called every n-th PWM reload */
#define M1_SLOW_LOOP_FREQ (1000) /* Slow loop frequency */

The ID current seems too become inverted. It measures negative while the setpoint is positive and this quickly results in an overcurrent trip. See screen capture below.


Next I tried too re-measure the parameters. This calculates a negative resistance and fails to spin the motor due to overcurrent trip.

M1_PWM_FREQ  -> 7.5kHz actually runs the motor, however Current FOC fails to spin the motor.

Identification at 7.5kHz runs through, but returns very different measurements (Rs(10kHz) = 0.93Ω vs Rs(7.5kHz) = 0.8Ω vs Rs(5kHz) = negative!).#

I thought the issue might be the PDB, however manually confirming initialisation values seem fine.

Can someone perhaps point me in a direction? 

Any help will be greatly appreciated.

0 Kudos
5 Replies

NXP Employee
NXP Employee


after the macro M1_PWM_FREQ is modified, it's necessary to recalculate control constant in MCAT and generate updated m1_acim_appconfig.h file. And also project rebuild is required.

You can check whether updated M1_PWM_FREQ is updated in Current loop MCAT tab. It's done after MCAT reload.


Let me know please if it helps.



0 Kudos

Contributor I

Hi Pavel.

Thanks for the response.

The 'Sample Time' in 'Current Loop Parameters' does indeed update, which I

didn't notice before.

I followed the following sequence:

1. Changed M1_PWM_FREQ to 1000.

2. Rebuild project.

3. Load firmware onto KV31 micro controller.

4. Open Freemaster project.

5. Check 'Sample Time' parameter (updated).

6. Measure Parameters.

1. Calculates Rs = -2.2Ω (takes much longer than when M1_PWM_FREQ is

10k, also at 10kHz the resistance is 0.98Ω).

2. Then the motor rotates CCW before starting to spin CW. The motor

spins for quite long (approximately 2 minutes) and then abruptly stops.

3. After approximately 30s the blocked rotor test message appears.

The windings remain energised as the rotor is tough to rotate

and the 1kHz

switching can be heard clearly. Again this test takes very long

to complete.

4. The mechanical parameters test runs quite quickly.

5. 1kHz


7. With the above parameters the motor runs well in both Speed and

Current FOC.

I am rather concerned with the negative stator resistance, surely this must

imply everything else is questionable?

1. Could you point me in a direction regarding the resistance and

accuracy of the parameters?

2. How can I get the inverter in the off state to safely block and

unblock the rotor (at 10kHz I'm sure it is off since the rotor rotates


3. Is there a way I can reduce the test duration? I understand a number

of samples are required to attain a reasonable accuracy, but I'd like to

fool around and hopefully come to a more realistic tradeoff.

4. I get an information message that Un is outside the hardware range

however UDCBusMax is 415V. Could you please elaborate on the reasons and

implications of this. See images below.

Thanks again for your prompt response and help.


Vickus (JL) Boshoff

082 557 4885

0 Kudos

NXP Employee
NXP Employee

Hello Vickus,

After discussion with a colleague, there's a need to do board calibration after PWM freq is changed (See AN5051, chapter 5.1.1.  Power stage characterization). It relates to dead time compensation.

However, it's enough to measure motor parameters with default PWM frequency (10kHz) and use those parameters for control constant calculation with updated PWM freq. You only need to re-calculate control constant after Sampling time is updated - re-generate appconfig.h a rebuild the project.

There might be still another problem, your very low PWM_freq. 1kHz is quite low switching frequency and I'm not sure if the control algorithms can still work properly. It's needed to be check..

Could you use PWM freq to not less then 5kHz?



0 Kudos

Contributor I

Hi Pavel.

The VSD is an existing product the is controlled by 56F8355 V/Hz we want to upgrade the control method and the KV series is a great fit since we have several other product using various other kinetis MCUs.

All the IGBT modules and their cooling is existing.

The 1kHz constraint comes from switching losses at full load, I can increase the switching frequency dynamically as the motor speed increases beyond nominal speed where the current drops.

I'm quite aware of the various problems that arise with low switching frequency especially at higher synchronous speeds, however deal with those when the project reaches that point.

Trying calibration results in the following:


The following message follows immediately after clicking OK in the following.


Running measure still calculates the negative Rs. Applying to the motor runs quite well.

Id appreciate if you could give me some feedback regarding the Rs.

Another remaining issue is the fact that the motor stays energised between tests (its not running but the inverter is definately injecting some current).


Kind regards


0 Kudos

NXP Employee
NXP Employee

Hi Vickus,

attached you can find attached fm_tsa_acim.c file which solves the issue with missing fm_I_increment variable. Just replace one in your project.

I've tested on my hw minimal PWM frequency. The theoretical minimal value is calculated: 

PWM_clock/2^15 = PWM_Freq_min -> 74000000 / 65535 = 1130Hz. Below this value register overrun happens.

However, the minimal working PWM freq I tested with a motor as about 2500Hz. Below this value the motor does not run correctly. It causes due to to application timing and control constant calculation which is not designed and validated for such low PWM freq.

My recommendations:

  • measure motor on 10kHz which the measured routines are designed for (timing is based on Ts, for lower PWM freq. higher Ts and longer times for every measuring phase - unblock / block)
  • change PWM freq to lower value (e.g. 2500Hz)
  • use params measured at 10kHz and generate new appconfig file reflecting lower PWM freq.
  • in this case you don't need to run calibration process
  • measured routine.

Generally, it would be possible to update the ACIM application for lower PWM freq (below 3kHz). However it would require major code update.



0 Kudos