cancel
Showing results for 
Search instead for 
Did you mean: 

B-G431B-ESC1 overcurrent issue when using quadrature encoder

Rajatkvsd
Associate

Hello everyone,

I am encountering an over-current issue with the B-G431B-ESC1 when attempting to use position control with a quadrature encoder. Here's what I've done so far:

Steps I Have Taken:

  1. Motor Profiler:

    • I uploaded the Motor Profiler firmware and ran the profiler to obtain the motor parameters. The parameters from the profiler are as follows:
    • Motor Parameters:

      • Hardware Family: MOTOR
      • Label: BDUAV C4250
      • Description: BDUAV C4250 560Kv
      • Pole Pairs: 7
      • Nominal Current: 40 A
      • Nominal DC Voltage: 24 V
      • Stator Resistance (Rs): 0.1 Ω
      • Stator Inductance (Ls): 0.02 H
      • Magnetic Structure: Surface Mount Permanent Magnet Synchronous Motor (SM-PMSM)
      • Back EMF Constant (BEmf): 1.53 V·s/rad
      • Inertia: 4.44 (unit depends on context, often kg·m² or g·cm²)
      • Friction: 3.63 (unit depends on context)
      • Max Rated Speed: 6020 RPM

      Quadrature Encoder Details:

      • Pulses Per Mechanical Revolution: 2048
      • Index Pin: Present

      Compatibility:

      • FOC (Field Oriented Control)
      • SixStep Control

      Motor ID: BDUAV C4250

  2. MC Workbench Configuration:

    • I created a new project in Motor Control Workbench for position control using a quadrature encoder.
    • I ensured the encoder configuration matched the profiler parameters:
      • Pole pairs: 7
      • Encoder PPR: 2048
      • Alignment with Index Pin: Enabled
    • I generated the code in CubeMX and uploaded the new firmware to the board.
  3. Testing in Motor Pilot:

    • When I open Motor Pilot and start position control, the controller goes into alignment for a brief moment, but I immediately get an over-current error.

Observations and Questions:

  • Could the issue be related to the current sensing setup (e.g., shunt resistors or calibration)?
  • Could the encoder count direction or alignment procedure be incorrect, causing the motor to draw excessive current during startup?
  • Is there anything else I should check or configure in the Workbench or CubeMX.

I have also attached a video showing the issue. the encoder speed graphs shows data when i move the motors manually .

5 REPLIES 5
Rajatkvsd
Associate

After lowering the current in startup parameter, now the ESC does not give over current error. when the ESC is run for the first time it changes its status in the following order:

Idle >> Alignment >> wait_stop_motor >> run

the motor does not move a lot during the alignment step and later the motor is not running at all it just stays stuck in one position. when i try to move the motor by hand (when status is run) it cogs on poles.

Hello @Rajatkvsd,

As mentioned in AN5464 document, after MC_StartMotor1, " It forces a constant magnetic field into the stator at a programmed angle" and maintained it until a stop or a new position command is ordered.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA
Joe WILLIAMS
ST Employee

Hi Rajatkvsd

This post has been escalated to the ST Online Support Team for additional assistance.  We'll contact you directly.

Regards

Joe

STMicro Support

Thank you for your prompt response. I have done the same steps in torque control now. I Have disabled the "Use absolute position control pin (ENC_Z)1" in the Speed Sensing Config. >> Quadrature Encoder setting but i still have the same issue. This is what happens:

for the first time the ESC status in the following order:

Idle >> Alignment >> wait_stop_motor >> run

once in run state and in torque control the i_q current measurement increases to the set-point value but the motor does not move.

I'm guessing the Alignment electrical angle is not getting set correctly during the alignment step in the beginning. is there anywhere that I have to set a higher current value perhaps?

I was able to fix the initial over current error by changing final ramp current value to 8A from the default value of 40A in the following settings:


Start-up parameters
Duration: 1000 ms
Alignment electrical angle of Id: 90 deg
Final current ramp value: 8A
Rajatkvsd
Associate

I found a similar issue discussed in the forum back in 2021: B-G431B-ESC1 Encoder Problem. My issue seems very similar, but unfortunately, there was no clear solution in that discussion. I have followed the troubleshooting suggestions from that topic and here are my new findings:


New Observations:

  1. Encoder Communication is Functional

    • The communication between the encoder and ESC seems to be working fine.
    • I am able to successfully plot the ENCODER_EL_ANGLE register.
  2. Unexpected Encoder Angle Variation

    • Based on discussions in the previous forum post, I plotted the ENCODER_EL_ANGLE register for one complete mechanical rotation (360°).
    • The result: The encoder angle varies by 17.5 rotations (6300°) for one full mechanical turn. attached image for reference.
    • My motor has 14 poles (7 pole pairs), and I am unsure if this relation is correct.

    Below is the relevant configuration from my startup parameters:

    /****************************** START-UP PARAMETERS **********************/

    /* Encoder alignment */
    #define M1_ALIGNMENT_DURATION 1000 /*!< milliseconds */
    #define M1_ALIGNMENT_ANGLE_DEG 90 /*!< degrees [0...359] */
    #define FINAL_I_ALIGNMENT_A 8 /*!< s16A */

    /************************
    *** 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.00002 /* Stator inductance, H */
    #define MOTOR_MAX_SPEED_RPM 6020 /*!< Maximum rated speed */
    #define MOTOR_VOLTAGE_CONSTANT 1.5 /*!< Volts RMS ph-ph /kRPM */
    #define NOMINAL_CURRENT_A 40
    #define ID_DEMAG_A -40 /*!< Demagnetization current */

    /***************** MOTOR SENSORS PARAMETERS ******************************/
    /*** Quadrature encoder ***/
    #define M1_ENCODER_PPR 256 /*!< Number of pulses per revolution */



    3. Alignment Step Seems Incorrect

    • During the initial alignment phase, I observed the following issues:
      • Alignment lasts only for a few seconds, which seems too short.
      • The measured I_Q_MEAS (torque current) is very low (< 0.1A) during alignment. you can see in the video attached.
      • However, after entering RUN mode, I_Q_MEAS reaches the expected 8A (FINAL_I_ALIGNMENT_A).

    I suspect that due to the low current and short alignment duration, the rotor is not aligning correctly, leading to incorrect position estimation and subsequent control issues.


    4. Manual Test of Encoder Response

    • To further test the encoder feedback, I tried removing the encoder from the motor and manually rotating it while the ESC was in RUN mode (with 8A applied in torque control mode).
    • Observations:
      • As I manually rotated the encoder, the motor followed the movement correctly.
      • This suggests that the motor control logic is responding properly to encoder feedback, but the initial alignment may not be working as expected.

    Questions & Request for Help

    • Is the electrical angle variation (17.5 rotations per mechanical rotation) expected for my motor (7PP, 256 PPR)?
    • Could this issue be due to incorrect setup parameters, or is it purely an alignment issue?
    • How can I ensure proper alignment before the RUN state or set the i_q_current value and duration for the alignment procedure?