2023-12-08 10:00 AM - edited 2023-12-08 11:42 AM
Squeeling starts, right around 2KRPM:
Solved! Go to Solution.
2023-12-13 11:33 PM
Glad to hear that you managed to get through it.
1. That's in fact a feature (open loop mode) currently missing but that will become available soon in the next release
2. I see you are using a wrong interface (the FOC one). You can load the 6step interface of the MotorPilot by clicking "GUI" in the upper bar, then "Load GUI". You have to select the "MC_6STEP_SDK.qml" file in the installation folder (that in my case was "C:\Program Files (x86)\STMicroelectronics\MC_SDK_6.2.0\Utilities\PC_Software\STMotorPilot\GUI"). You can get all the updated documentation on the web page Web page documentation or in Motor Control wiki wiki_Motor_Control
3. To avoid the conflict between MCU resources, select a different timer for the speed controller in the workbench (tab "Speed sensing config", for instance TIM4)
2023-12-08 07:46 PM - edited 2023-12-08 07:47 PM
What is rated speed of motor? if you have to go beyond rated speed you have to apply flux weakening.
2023-12-08 08:19 PM - edited 2023-12-08 08:24 PM
This motor can run up to 20K RPM with the load I've profiled with and using (a small 2" tri-blade), and I've used it that way extensively with other 6-step controller+driver pairs (both commercial ESC and ones of my own design). I don't necissarily need to drive it up to 20K, but it should absolutely go past 2K.
The reason I want to drive it in 6-step with the B-G431B-ESC is I want a direct comparison between FOC and 6-step on same supply+controller+driver.
2023-12-08 08:51 PM
I am not sure how your code looks like, but to control the maximum speed few configuration parameters available in the source code header files
pmsm_motor_paramters.h
#define MOTOR_MAX_SPEED_RPM 1000 /*!< Maximum rated speed */
drive_parameters.h
/*** Speed measurement settings ***/
#define MAX_APPLICATION_SPEED_RPM 1000 /*!< rpm, mechanical */
please verify the above settings.
2023-12-08 09:51 PM - edited 2023-12-08 10:02 PM
These files are generated from the motor profile... Mine has a value of 12000 (the speed I ran my motor up to in profiling)
{file contents in case this helps}
/**
******************************************************************************
* @file pmsm_motor_parameters.h
* @author Motor Control SDK Team, ST Microelectronics
* @brief This file contains the parameters needed for the Motor Control SDK
* in order to configure the motor to drive.
*
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2023 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* www.st.com/SLA0044
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef PMSM_MOTOR_PARAMETERS_H
#define PMSM_MOTOR_PARAMETERS_H
/************************
*** Motor Parameters ***
************************/
/***************** MOTOR ELECTRICAL PARAMETERS ******************************/
#define POLE_PAIR_NUM 7 /* Number of motor pole pairs */
#define RS 0.1 /* Stator resistance , ohm*/
#define LS 0.00001 /* Stator inductance, H
For I-PMSM it is equal to Lq */
/* When using Id = 0, NOMINAL_CURRENT is utilized to saturate the output of the
PID for speed regulation (i.e. reference torque).
Transformation of real currents (A) into int16_t format must be done accordingly with
formula:
Phase current (int16_t 0-to-peak) = (Phase current (A 0-to-peak)* 32767 * Rshunt *
*Amplifying network gain)/(MCU supply voltage/2)
*/
#define MOTOR_MAX_SPEED_RPM 11976 /*!< Maximum rated speed */
#define MOTOR_VOLTAGE_CONSTANT 0.3 /*!< Volts RMS ph-ph /kRPM */
#define NOMINAL_CURRENT_A 5
#define ID_DEMAG_A (int16_t)-5 /*!< Demagnetization current */
/***************** MOTOR SENSORS PARAMETERS ******************************/
/* Motor sensors parameters are always generated but really meaningful only
if the corresponding sensor is actually present in the motor */
/*** Hall sensors ***/
#define HALL_SENSORS_PLACEMENT DEGREES_120 /*!<Define here the
mechanical position of the sensors
withreference to an electrical cycle.
It can be either DEGREES_120 or
DEGREES_60 */
#define HALL_PHASE_SHIFT 300 /*!< Define here in degrees
the electrical phase shift between
the low to high transition of
signal H1 and the maximum of
the Bemf induced on phase A */
/*** Quadrature encoder ***/
#define M1_ENCODER_PPR 400 /*!< Number of pulses per
revolution */
#endif /* PMSM_MOTOR_PARAMETERS_H */
/******************* (C) COPYRIGHT 2023 STMicroelectronics *****END OF FILE****/
2023-12-11 04:25 PM
I didn't mention, but probably should.... these profiles+motors work just fine with the FOC algorithm and spin up to ~12K RPM, so to recap:
1) B-G431B-ESC + Profiled motor + MCW generated FOC application = FINE (spins up to ~12K, probably would go faster but not going to push it-yet)
2) B-G431B-ESC + Profiled motor + MCW generated 6-step application = BROKEN (spins up to ~2K, then starts to squeel and lose power and draw lots of current)
2023-12-12 01:01 AM
- What are the BEMF thresholds and demagnetization period that you set?
- In the image, the yellow curve looks weird: the baseline is negative. Is it an acquisition issue?
- Did you try to reduce at minimum the PID gains to exclude a speed controller issue and run the motor in pseudo open-loop mode?
You can also have a look at the UM3259 for troubleshooting UM3259 - 6-step firmware sensor-less parameter optimization
Despite the issue at 2krpm, If I'm not mistaken, the motor is running at 16kHz. Consider that with 7 pole pairs, it means around 10 pwm cycles for each step (10 bemf acquisitions or less if you consider the demagnetization time) at 2krpm and less than 2 cycles at 12krpm. It won't simply work at that frequency with 6step.
2023-12-12 08:08 AM - edited 2023-12-12 08:16 AM
>>What are the BEMF thresholds and demagnetization period that you set?
I have tried all different values, nothing helps. In fact I've adjusted every single parameter in the MCW.
>> In the image, the yellow curve looks weird: the baseline is negative. Is it an acquisition issue?
I don't think so, I am using a working oscilloscope, and the signal looks perectly normal right before 2Khz, (the first image).
I just know that the trapezoidal waveform looks much different immediately when the problem threshold RPM (~2K) is hit. I've never seen anything like this on other platforms I've implemented 6-step BLDC commutation on
>> Did you try to reduce at minimum the PID gains to exclude a speed controller issue and run the motor in pseudo open-loop mode?
Yes I tried reducing the PID gains and it didnt help, it approaches the breaking point much slower of course, but still breaks at exactly the same speed (right around 2KRMP)... I'm very new to this ecosystem -what is pseudo open-loop mode and how do I enable it?.
I've tried several motors and this issue always occurs, so I think there must be a bug in the hardware or software (I don't believe this is a bug in my hardare, since the FOC algo works nicely), could you try it on your end?
All I did was create a new 6-step project using my profiled motor (which again works great with a FOC project) and choose "B-G431B-ESC" as the inverter, generate code, build, run and it breaks around 2KRPM.
2023-12-13 01:19 AM
I tried to replicate your set-up with the G431-ESC. I used a BullRunning BR2804 motor (the one pre-defined in the workbench) that looked similar to yours (rated voltage 12V, 7pole pairs, high rated speed, low voltage constant)
1. At first I ran it at 16kHz. Improving the speed loop gain, reducing the bemf thresholds and the demagnetization time at the beginning of each step ("minimum demag time" in the "Drive settings" section), I easily reached 4.5krpm. Beyond this speed, the motor starts to hiccup until overcurrent occurs. As said in my previous post, at this speed there are very few points to discriminate the bemf zero crossing (4-5 points, one each pwm cycle) and the desyncronization of the rotor is unavoidable
2. Then I increased the frequency to 50kHz, reduced the 6step loop execution time (to limit the number of interrupts and the MCU load), tuned the startup parameters and the delay between the zero crossing and the step changed. I reached over 12krpm.
I attached the screenshots and the wbmx6 files I used to generate the code, hoping that they are of any help.
2023-12-13 08:25 AM
Thanks, I was able to get the motor working at nearly desired RPM using the combination of things you mention.
1. You metioned some kind of open loop mode where I'd be able to directly set
2. The circled are in the picture above has strange values which I don't udnerstnad the meaning of. . Where can I get most up to date documentaiton on all of these parameters? (I find the format of the PID controller values very confusing)
3. When I try to enable the ESC PWM control input, I get an error for re-allocation of TIM2 on the build. What is TIM2 used for in this app and can another timer be used instead (ESC PWM detection seems can only use TIM2, which makes sense since there's a hardware connection there)