cancel
Showing results for 
Search instead for 
Did you mean: 

MCSDK 5.Y.1 G431RB/STDRIVE101 Motor Speed Control

ATzou.1
Associate II

My desire is to find some detailed documentation on the MCSDK 5.Y.1 project generated and how to exercise the motor using the Motor Pilot. Specifically:

•   Change the initial startup speed

•   Change the speed of the motor (while the motor has already started up and is running)

•   Detailed descriptions of the ‘speed reference’ and how to configure/use the ‘speed ramp’

•   Tune the project parameters to make the motor rpm speed run steady at speed with less variance about the desired speed (currently the motor is +/- 500 rpm about 2500 rpm as configured in my project)

Details of my configuration and accomplishments so far …

•   can successfully build/download/run the project using the STM32CubeIDE and then run the Motor Pilot application and connect to the MCU via 1.8432 MBaud on the VCom port.

•   can start the motor but about 15% of the time I get a startup fault ‘speed feedback’

•   can change the motor speed from positive to negative by adjusting the ‘speed reference’ but can only achieve two configurations -2500 rpm and + 2500 rpm with +/- 500 rpm variance about the mean speed

•   speed ramp does not have any effect

•   Using an X-NUCLEO-IHM16M1 on the NUCLEO-G431RB I was able to successfully run the MotorProfiler (5.Y.1). I’ve attached the profile results. With the ‘play’ interface I was able to control the speed of the motor within +/- 2920 rpm.

Software/Hardware Configuration

•   Motor Control SDK 5.Y.1

•   Motor Pilot V0.9.2 (5.Y.1)

•   STM32CubIDE 1.6.1

•   NUCLEO-G431RB (STM32 Nucleo-64 development board)

•   EVALSTDRIVE101 (STDRIVE101 demonstration board for three-phase brushless motors)

•   X-NUCLEO-IHM16M1 (Three-phase brushless DC motor driver expansion board)

•   6 inch 34-Pin 2x17-Pin 2.54-Pitch Female 34-Wire IDC Flat Ribbon Cable

•   Anaheim Automation BLY172S-24V-4000 (BLDC Motor with Hall Sensors)

I have successfully used the MCSDK to create a new project as follows:

•   Application Type: Fans

•   System: Single Motor

•   Control Board: (Power & Control) NUCLEO-G431RB (based on STM32G431RB)

•   Power: EVALSTDRIVE101 3Sh (based on STDRIVE101)

•   Motor: Generic Low voltage <= 50V

Project Configuration:

•   Motor: Surface Mounted PMSM

o   Motor: 4 pole pairs, Max App Speed 4000 rpm, Nom Current 3.5A, NomDC Voltage 24V, Rs 0.8 Ohms, Ls 1.2 mH, B-Emf constant 3.35

o   Sensor: Hall Sensors

•   Speed Sensing

o   Main Sensor: Hall Sensors

•   Firmware Drive Management

o   FreeRTOS: enabled

9 REPLIES 9
Laurent Ca...
Lead II

Dear @ATzou.1​ 

Many thanks about the details you have given about your setup.

Regarding documentation, a first wiki page about STM32 MC Motor Pilot will be available mid of next week on our STM32 Motor Control Knowledge Database website: https://wiki.st.com/stm32mcu/wiki/Category:Motor_Control .

Best regards

cedric H
ST Employee

Dear @ATzou.1 (Community Member)​ 

"can change the motor speed from positive to negative by adjusting the ‘speed reference’ but can only achieve two configurations -2500 rpm and + 2500 rpm with +/- 500 rpm variance about the mean speed"

This is symptomatic to a bad connection of your hall sensors and/or your three motor phases.

With hall sensors, it is important to respect the phases order, and the different H1.H2.H3 hall sensors connections.

Additionally, you have to configure the electrical angle placement.

In the Motor Parameters configuration window inside the Sensors tab, in the Hall sensors section, you have a "Placement electrical angle" field.

This field represents the shift between the electrical angle of the rotor and the angle seen by the sensors.

To determine this angle, the easiest way is to generate a project with the sensorless algorithm ( STOPLL for instance) as primary sensor, and Hall sensor as auxiliary sensor. With the Pilot and the new Motor control Protocol, we have now access to a lot of data, and you can plot simultaneously the angle seen by the hall sensors and the angle seen by the sensorless algorithm. Both sawtooth must be superseded.

We plan to add the profiling of the hall sensors soon in the profiler to help our customers to connect the sensors correctly and to automatically find the electrical angle parameter.

If sometime you have a speed feedback error with your hall sensors, then there is a probability that one of your sensor is damaged.

when you are in hall sensor configuration this error is reported only if the reading of the 3 Hall sensors is not inline with one of the 6 expected values.

Hope it helps

Regards

Cedric

Thank you. This wiki will be highly useful.

Adjusting the Electrical Angle Placement gave me the best results. All is well now and works as desired and expected. Only feedback that I have is

  1. the measured rpm speed in the Motor Pilot application bounces around more than I expected when using the drone/freertos application
  2. the power in the Motor Pilot application exceeds 64k and the power bar is full red maximum height in the display.

Thanks.

Hello @ATzou.1​ ,

Happy to read that it works as expected.

If the speed bounces around more than you expect, I would advise to tune the PID speed.

64k ? do you mean 64 Watts ? You can change the scale of the power bar by clicking on "Application Configuration" button at the bottom left of the Pilot.

Regards

Cedric

64k as in 64,000, yes units of Watts. I'm seeing values of 65535 and a full height red bar. Seems like a bug in the backend for the power computation for the display.

Yes, adjusting the speed Kp and Ki smoothed out the needle on the measured rpm.

A picture is worth a thousand words.

Thanks a lot,

Indeed, the power level is not correct. I raised a ticket on our side to work on a fix.

Regards

Cedric