Skip to main content
Gmatt.1
Associate
June 18, 2021
Question

B-G431B-ESC1 Encoder Problem

  • June 18, 2021
  • 10 replies
  • 3280 views

Hi

I want to make a position control with a B-G431B-ESC1.

I use a motor with an encoder with 1024 PPR.

Motor profiler ended with no problem.

I started a project in motor control workbench Ver. 5.Y.1.21203 setting the encoder in motor settings and in speed sensing.

I tryied to generate the code but i get following errors:

Type Time   Motor  Id  Message

UNK  09:07:29        A0 is used in: Encoder Interface Timer( TIM2 ).CH1, Bus Voltage feedback ADC( ADC1 ).ADC12_IN1

UNK  09:07:29        A1 is used in: Encoder Interface Timer( TIM2 ).CH2, Phase current feedback OPAMP( OP1/OP2/OP3 ).ChU NoInv

Any help?

Thanks

This topic has been closed for replies.

10 replies

erno.1
Visitor II
June 18, 2021

Motor control workbench -> Digital I/O -> Encoder interface -> Timer= TIM4 CH1=B6 CH2=B7

Gmatt.1
Gmatt.1Author
Associate
June 18, 2021

Thanks

Now it compile but i have another issue.

I set in drive settings control mode as "Position control".

I generate the code, compile with Stm32CubeIDE and upload.

However in Motor Pilot 5.Y.1 i only find control mode "Torque" an "Speed" but not "Position".

How can i set the position of the motor?

Thanks

erno.1
Visitor II
June 18, 2021

There is no ui for position control.

Position control example in "MC_SDK_5.Y.1\Projects\NUCLEO-F303RE\Demonstration\PositionControl\Src\main.c".

Laurent Ca...
Senior III
June 21, 2021

The question has been set only to the "STM32 Motor Control" topic (the question is only about the STM32 MC SDK). 

Best regards

saghl.1
Visitor II
June 23, 2021

I am having a Similar problem and I hope someone could help as I don't even know how to debug my issue.

I have taken all the steps above and I'm trying to run speed control loop but as I try to do speed control with quadrature encoder rather than sensor-less mode, the motor doesn't turn. it makes some constant noise and it doesn't move at all.

the same experiment works if I change the speed sensing block's properties to sensor-less but if I choose quadrature encoder it just makes some noise and no motion. I have tested the encoder and all signals look correct on the scope. When I turn the motor by hand I can see under "Measured Speed" that it is being measured correctly.

Here are some screenshots of my settings

0693W00000BbkbzQAB.png0693W00000BbkbuQAB.png0693W00000BbkbpQAB.png0693W00000BbkbkQAB.pngAny advice is greatly appreciated.

erno.1
Visitor II
June 23, 2021

Have you tried to switch encoder A and B wires?

Encoder rotation direction should match motor rotation direction.

saghl.1
Visitor II
June 24, 2021

I have, In fact even if I remove the encoder wires the behavior is the same, which is very strange.

saghl.1
Visitor II
June 24, 2021

I looked at the phase signals on the scope and all phases seem to turn on and off at the same time. (hence the rotor is locked)

here is PhaseA vs Phase B

0693W00000BbrBFQAZ.jpgPhase A vs Phase C looks exactly the same

saghl.1
Visitor II
June 24, 2021

One major question for me is how does this hole pipeline find out the alignment between encoder and stator? I initially thought "Encoder Align" button would do it (maybe by using the estimator internally to find the alignment?) but pressing that applies some voltage to the motor for like 1 second and stops (it doesn't move the shaft at all). Also the Z signal from the encoder doesn't seem to be used in the ControlWorkbench/generated code(this is another thing I would have thought is necessary for alignment.)

erno.1
Visitor II
June 25, 2021

What I have learned while using motor control workbench:

 Encoder and motor are synchronized when start button is pressed first time.

 Status is "alignment" during alignment in motor pilot. It will do it only once after boot

 Motor movement should not be blocked during alignment.

If motor is not moving when its doing alignment (movement could be only few degree) motor nominal current and final current ramp value may be too small.

 Motor is forced to "alignment electrical angle" position by corresponding phase currents.

 After motor is in known position it will set the encoder.

One way to test encoder:

- In motor pilot change mode to torque and torque reference to 0 and plot from ASYNC config tab encoder_el_angle when rotating motor slowly using other motor

(status should be run)

- If motor has 7 pole pairs then there should be 7 transitions in plot in one turn. This is easier to see when plotted from registers tab and rotating by hand (low sample rate).

In your picture serial baudrate is 115200 in 5.Y.1 default is 1843200. If its not try to start new project, that fixed it for me (I had imported old project).

in 5.Y.1 POSITION_ALIGN_STATE register is not yet implemented. It is always read as ALIGNMENT_ERROR

0693W00000Bc0vDQAR.png

saghl.1
Visitor II
July 10, 2021

Thank you @erno.1​ for quick response, once I saw your snapshot I realized I'm using an older version of the motor control workbench, however even after updating the software and doing all the steps from scratch on a new project I was still getting the same behavior.

fyi, I was able to get the encoder graph by just plotting encoder_el_angle under torque control mode as you suggested but the motr doesn't respont to any positive torque command or velocity command. it just gets stuck, I tried the same thing with a new PCB thinking maybe I have mistakenly damaged the board but the behavior was the same.

At this point I'm gonna give up on this thinking there are bugs in the whole product which hopefully will be resolved for other people. I'm going to try another vendor.

PKVSK.2
Visitor II
December 22, 2022

Hello Laurent.

I have an error popping up which says "Main sensor set to Quadrature Encoder, but the motor doesn't support it"

I have initialized Quadrature Sensor in the sensing block, changed timer to TIM4 and its respective pins.

I request ST support to help me with this issue since I'm NOT able to generate the .ioc file with Workbench