Revision as of 13:12, 19 March 2021 by Registered User (Escoda Michael moved page Frequently Asked Question to STM32 MC Frequently Asked Questions without leaving a redirect)

Main sections

  1. STM32 MC Ecosystem
  2. STM32 MC SDK Usage
  3. STM32 MC SDK Features

Note:

  • MC = Motor Control
  • SDK = Software Development Kit

This page contains some Frequently Asked Questions (FAQ) related to STM32 Motor Control.

1. STM32 Motor Control Ecosystem

1.1. What is the purpose of the STM32 MC SDK?

The ST Motor Control Ecosystem includes also the STM32 Motor Control Software Development Kit (X-CUBE-MCSDK). Its purpose is to speed up the evaluation and development of a FOC algorithm (Field Oriented Control) for Permanent Magnet Synchronous Motor (PMSM) applications.

The STM32 MC SDK is running with the STM32 MCU families implementing advanced timer (Cf. its Release Note for more information), and it is composed of the :

    • STM32 MC firmware (FW) library – currently FOC control only
    • ST MC Workbench – PC Graphical User Interface (GUI) tools to configure the FOC firmware library parameters and to perform real time monitoring
    • ST Motor Profiler – PC tools able to measure the Motor Parameter automatically and to update the ST MC FW library, through the ST MC Workbench usage

1.2. What are the changes from previous version?

Please, refer to the STM32 MC SDK Release Notes as provided with each version released.

1.3. What is the STM32 Motor Profiler Tool?

This is a tool that automatically measure the electrical parameters of PMSM motors. It is useful to run motor with unknown specifications in less than a minute.

The used algorithm determines the motor parameters needed to configure the STM32 MC FW library : Stator resistance Rs; Stator inductance Ls; Back EMF Constant; Motor Inertia and Friction.

Please, refer to the STM32 SDK Motor Control tools document for more details (UM2380).

2. STM32 MC SDK Usage

2.1. How to create a Motor Control project?

Please, read first the MC SDK - Getting Started manual (UM2374). Then, you can either starts from a motor control example project, or either from a new project design.

Tips :

  • Don’t forget to create and save your project into your dedicated working directory.

2.2. How to handle project made with previous version of the STM32 MC Workbench?

The STM32 MC Workbench migrates automatically older *.stmcx file to the current version. Please, note that before the migration, an information window is popping-up to prevent you. Click yes if you agree with this conversion (Please, note that there is no backward possibility after migration).

With regards to the user application software itself, please, refer to the document "How to migrate motor control application software from SDK v4.3 to SDK v5.x" (AN5143).

Tips :

  • Get a copy of all your original files.
  • Don’t forget to create and save your project into your dedicated working directory.

2.3. How to get a project framework for particular IDE (IAR, KEIL, …)?

User may start from :

Either a motor control application software example as provided into the “./Projects” directory for all supported IDE : IAR, KEIL or GCC based (Please, read its attached ReadMe.txt file);

Either a pre-configured motor control application example project, or a new created one, via the STM32 MC Workbench usage. Then, user selects the wanted IDE, as well as the STM32CubeMX version, before to generate his/her motor control application software example.

Tips :

  • Don’t forget to create and save your project into your dedicated working directory.

2.4. Why the STM32 Motor Profiler Tool doesn’t recognize my motor?

Apart from the applied checklist provided bellow, this tool has currently few limitations (Rs > 1 Ω, Ls > 1 mH) which may prevent it to recognize your motor in a reliable way.

However, user should check the following list in priority:

  • Apply nominal voltage;
  • Select the power stage with proper current range;
  • Fill nominal motor speed parameter or play with this value;
  • Decrease nominal current parameter;
  • Decrease applied bus voltage.

2.5. Why my motor doesn’t start immediately?

Although your motor is running fine, it doesn’t start immediately for one of the following reason:

  1. During initialization, a motor alignment is needed to start from a known position. In other words, it means the initialization phase sets a static stator vector and waits until the rotor vector aligns with this position.
  2. When the “On-the-Fly startup” feature is Enabled. Before any motor drive, this feature starts a detection phase:
  • When the rotation is detected, it skips the start-up phase and runs directly in the close-loop mode.
  • When the rotation is not detected, it runs the start-up phase : alignment, ramp-up, …

2.6. How to choose the basic set of ramp-up parameters for a motor?

Most of the time, we have noticed that setting the ramp-up parameters as follow makes motor will run the first time :

  • Check the box “Include alignment before ramp-up”;
  • Set the motor alignment “Duration” to 2000 ms;
  • Set the motor alignement “Final current ramp value” from ½ of nominal motor current (in A);
  • Set the “Speed ramp duration” to 3000 ms;
  • Set the “Speed ramp final value” to 30% of maximal motor speed (in rpm);
  • Set the “Current ramp final value” from ½ of nominal motor current (in A);
  • Set the “Minimum start-up output speed” to 15% of maximal motor speed (in rpm).

After a first successful run, you need to fine tune these parameters.

2.7. How To choose the PWM frequency and the FoC execution rate?

The choice of the PWM frequency and the FOC execution rate is a compromise between available speed and switching losses.

  • In case of a high speed motor or a low inductance motor, you have to use a high PWM frequency (e.g. 30 kHz).
  • In other cases, a lower PWM frequency (e.g. 16 kHz) is, most of the time, enough.
  • In all cases, you have to check the maximal PWM frequency capability for the selected MCU.
  • In case of a low inductance motor, it is possible to increase the FOC execution rate while keeping a high PWM frequency to save CPU load; or to migrate to a lower performance MCU (e.g. PWM = 30 kHz and a FOC execution rate = 2 means the FOC algorithm runs @ 15 kHz).

2.8. Why do I have a “FOC duration” fault message and the motor don’t even try to start?

This fault message appears when the FOC execution rate is too high and the FOC algorithm computation cannot fit within the PWM period.

Open the Drive Settings window and decrease the ratio between the PWM frequency and the Torque and flux regulators execution rate as shown below (e.g. Increase this execution rate by one).

2.9. Why do I have an “Over current” fault message and the motor don’t even try to start?

This fault message appears from the following situation :

  1. A wrong current sensing topology has been selected. Please, check and select the right current sensing configuration.
  2. A Wrong current sensing parameters has been set. Please, check and correct the current sensing parameters.
  1. The current regulation loop bandwidth is too high for this HW setup. Please, open the Drive Settings window and decrease the current regulation loop cut-off frequency (e.g. Down to 2000 rad/s for a 3-shunt topology and 1000 rad/s for a 1-shunt topology). Typical maximum current regulation loop bandwidth values are 9000 rad/s for a 3-shunt topology and 4500 rad/s for a 1-shunt topology.

2.10. Why do I have a “Speed feedback” fault message during the acceleration phase and the motor stop?

Often, this fault message appears following an abrupt Torque variations demand at the end of the start-up phase. This spoils the Back-EMF estimator.

  • 1. The observer gain G2 is too high and this makes the speed reconstruction a bit noisy for the used speed PI gains (causing estimator reliability trouble). Then, possible solutions are :
    • Decreasing the observer gain G2 by successive steps : /2, /4, /6, /8.
    • Running the motor in torque mode. When this trouble disappears in torque mode, it means the speed regulator gains are not optimal. Please, trim the gain values (Cf. dedicated FAQ).
  • 2. The start-up phase ends too early. Then, possible solution are :
    • Increasing the “Consecutive successful start-up output tests” parameter (normally not more than 4-5);
    • Setting the “Minimum start-up output speed” parameter to 15% of your maximal application speed, then decreasing it for fine tuning.

Tips :

  • Smooth the speed variation between the “Minimum start-up output speed” and the “Speed ramp final value” playing with the “Speed ramp duration”.

2.11. Why do I have a “Start-up failure” fault message during the rev-up phase and the motor stop?

Typically, this fault message appears because the provided current is not enough to support the speed acceleration.

  • 1. Decrease the speed acceleration rate :
    • Increase the “Speed ramp duration” parameter;
    • Set the “Speed ramp final value” parameter to 30% of your maximal application speed.
  • 2. Increase the start-up current :
    • Increase the “Current ramp initial value” parameter;
    • Increase the “Current ramp final value” parameter up to the “Nominal Current” parameter of your motor;
    • Check the “Include alignment before ramp-up” box to make the start-up phase more deterministic … and follow the FAQ about Basic parameters settings for the ramp-up.

2.12. Why do I have a “Start-up failure” fault message during the acceleration following the rev-up phase and the motor stop?

Often, this fault message appears following an abrupt Torque variations demand at the end of the start-up phase. This spoils the Back-EMF estimator.

  • 1.The observer gain G2 is too high and this makes the speed reconstruction a bit noisy for the used speed PI gains (causing estimator reliability trouble). Then, possible solutions are :
    • Decreasing the observer gain G2 by successive steps : /2, /4, /6, /8.
    • Increase the “Variance threshold” parameter to release the check mechanism : Up to 80% for Observer+PLL, Up to 400% for Observer+CORDIC.
  • 2. The reliability capture window of the estimator is too small. Then, possible solution is :
    • Increase the “Speed ramp final value” parameter up to 40% of your maximal application speed;
    • Decrease the “Minimum start-up output speed” parameter down to 10% of your maximal application speed.

2.13. How To interface the MC firmware library?

Several Motor Control APIs has been implemented to interact with the firmware library in a basic way.

Please, refer to the on-line Firmware Reference information, which content all these details and more :

  • From the STM32 MC Workbench menu (Documentation -> Firmware Reference);
  • From the Windows Start-up menu (ST Motor Control SDK xxx -> Reference Manual xxx).

2.14. How To choose the hardware Power board?

While it is not true for the nominal bus voltage, usually, the maximal current (torque) used by your application is different from the maximum current of the motor.

As a consequence, you can spin a motor with a reduced power range for your Power board.

Of course, the best case is when the maximum current of the motor is part of the current range from your Power board.

2.15. How To debug a motor control application?

A Motor Control application cannot use the standard debug mechanism : HW or SW breakpoints holding the program.

The reason is that during the break, your application is losing the real rotor position Vs the needed magnetic field computation phasing with the firmware execution.

So, we usually use the DAC (or an emulated DAC, thanks to a PWM output) and/or the USART communication:

  • The DAC can generate a voltage reflecting internal signals (e.g. Currents, B-EMF voltage, or reconstructed angle). Then, it provides capability to scope this waveform during the motor spin. Best is to dedicate two pins of a DAC output
  • The USART can provide data, but at a lower rate than the DAC. It requires the two Tx/Rx pins and the STM32 MC Workbench tool to monitor these data.

2.16. How To make the current more sinusoidal when motor spin?

Probably, the PI gains of the Speed regulator are incorrects.

Decrease the Kp gain and act on the Ki gain (evaluating the speed regulation) to check over/under-shooting during transients.

2.17. How To tune the PI Speed regulator?

Among the possible ways, one is pragmatic as described follow:

  1. Run the motor and connect it to the STM32 MC Workbench;
  2. Open its monitor mode and switch-on the plotter window;
  3. In the “Final ramp speed” box, enter the new reference speed (e.g. Change speed from 2 000 rpm to 4 000 rpm).
  4. In the plotter windows, check the measured speed reaction : fast but oscillation existence around final value, or too slow reaction :
  • If regulated variable oscillates around a value, then decrease KI or increase KP.
  • If the trend of regulated variable is too slow or not stabilize, then increase KI.

2.18. How To connect ICS with the MC FW library?

Our implemented ICS requires usage on 2 phases among the 3.

As the STM32 MC FW library is operating only Phase U and Phase V, this is where user should connect each ICS.

2.19. Why using the FOC Vs 6-Steps control for PMSM drive?

The FOC brings the following benefits :

  • Better energy efficiency;
  • Responsive time of speed control;
  • Precise position control;
  • Lower acoustical noise.

2.20. Why using the 3-Shunts Vs 1-Shunt resistors implementation for current measurement?

Using the 1-Shunt implementation for measurement is the cheapest solution.

However, some motor (e.g. a low inductance motor) require currents measurement on two phases simultaneously. Then, only the 3-Shunts implementation can match.

3. STM32 MC SDK Features

3.1. Does the STM32 MC SDK support Power Factor Corrector?

Yes, it does.

Depending on your HW setup, the STM32 MC SDK is able to drive up to 2 PMSM motors with a PFC stage.

User includes this feature usage from the main window, then configures and enables it from the PFC pop-up window.

3.2. Does the STM32 MC SDK support a Dual drive motors?

Yes, the STM32 MC SDK supports a Dual drive motors using only one MCU.

3.3. Does the STM32 MC SDK provides project examples using FOC or 6-Steps control for PMSM drive?

Yes, the STM32 MC SDK provides project examples to demonstrate FOC or 6-Steps control implementation.