cancel
Showing results for 
Search instead for 
Did you mean: 

B-G431B-ESC1 motor profiler not working (moderator note: this post contains now a bug-fix patch on provided example)

nik8540
Associate II

Hi,

I am trying to use motor profiler 5.4.4 with B-G431B-ESC1. Every time, Electric model reaches 30 percent quickly and then gradually reaches 38 percent to get the 'too much time' warning after which process fails.

I tried different BLDC motors (12 pair-400KV, 7 pair-1900kv)and also tried different supply voltage(12V, 16V, 25V). However result is same.

I can also see few other posts which mentions about similar issue, however, they have not been answered.

Any help to resolve this is much appreciated.

29 REPLIES 29
JA.1
Associate III

Hi again @DB.7ERGANTIN​ 

Are you sure that no other hack is needed than replacing the r3_2_g4xx_pwm_curr_fdbk.c file and moving the RCM_ReadOngoingConv() function call up?

The new firmware with the motor profiler works for me, but using the setup with MotorControlWorkbench generated code (and applied hacks) is not working. I cannot change the speed of the motor, it will always rotate with same speed no matter the value in MC_ProgramSpeedRampMotor1()...

DBE
ST Employee

​Hello,

The hacks should solve a problem that appears when the motor is started for the first time after a MCU reset or at run time due to ADC issue.  But here it seems to be something else as your motor is spinning. I just did the experiment on my side and I can change the speed with MC_ProgramSpeedRampMotor1() routine. do you have the same issue if you use the MC workbench monitor? Which toolchain do you use?

Best regards

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.
JA.1
Associate III

Thanks for getting back @DB.7ERGANTIN​ . The following is the steps I've taken:

  1. Motor Profiler 5.4.4
    1. Run and succesfully save the result. Playing around with the motor and speeds is also working here.
  2. Open MotorControl Workbench 5.4.4
    1. Select board (B-G431B-ESC1) and motor from previous step.
    2. Add Hall sensor as speed sensing element.
    3. Lower PWM freq. to 10KHz (using default of 30KHz will lead to software error in MC Workbench).
    4. Leave everything else as default (current sensing topology is by default set to Embedded PGA with Sensing OPAMP peripheral selection set to OP1/OP2/OP3 Int gain type 16).
    5. Generate project for:
      1. STM32CubeMX 6.0.1
      2. ST STM32CubeIDE
      3. STM32 FW V1.3.0
      4. HAL Drive Type
    6. I always here get the warning popup: "- These IPs still have some not configured ...: [ADC2]"
    7. I proceed and generate the code.
  3. From here I have tried different routes:
    1. Open generated project directly with STM32CubeIDE 1.4.0
      1. Applying the hacks you've mentioned.
      2. When running the motor (both by pressing the onboard button or via MC Workbench Monitor) the motor draws 10+ amps without running and I quickly stop it.
    2. Open first generated project with STM32CubeMX 6.0.1
      1. Fixing the ADC2 warning (ADC2 Rank 2 channel is set to "Channel Vopamp3" but the program wants me to set it to "Channel 3".
      2. Generate output and test again (as in step 3.1.2 also with hacks applied) with same result.
      3. I have also discovered that the OPAMP1, OPAMP2 and OPAMP3 in Analog part in CubeMX are not set. I have tried setting all three of them to "PGA Connected-INVERTINGINPUT_IO0_BIAS" and generating project again.
        1. After applying hacks again, I can now get the motor spinning without drawing 10+ amps but as mentioned without being able to control the speed.

What am I missing here?

Thanks

DBE
ST Employee

Hello,

The fact that you are using Hall sensors for speed sensing and that the motor does not move but draws lot of current (3.1.2) or spins without being able to control the speed makes me think that there is perhaps an issue on the Hall sensors settings in the project. Could you please verify that the sensor displacement and the placement electrical angle are correct in the "motor parameters->sensors" panel in MC Workbench? Please verify also that the motor phase U,V and W are connected to OUT1, OUT2 and OUT3 respectively to the board. The fact that Motor Profiler is working fine as you said, seems to confirm this hypothesis as Motor Profiler does not use the Hall sensors.

 ​Best regards

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.
JA.1
Associate III

Connecting the motor correctly with the phases solved this issue... :confounded_face:

Thank you very much for fast and precise support! Appreciate it. Have a nice day.

DBE
ST Employee

​You are welcome.

By the way, I realized that line 1033: LL_ADC_REG_StartConversion(ADCx_2); in the  r3_2_g4xx_pwm_curr_fdbk.c file I sent should be removed. This was for debugging purpose.

Best regards

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.
JA.1
Associate III

I've removed the line from the file. Thanks.

While having you here, I also have another matter to solve:

I the MC setup, the OPAMP1, 2 and 3 outputs are set to pin A2, A6 and B1. These output pins are then fed to the ADC: ADC1_IN3 (A2), ADC2_IN3 (A6) and ADC1_IN12 (B1).

In my setup, I need to use these pins A2, A6 and B1 for other GPIO purposes (already used all the other pins). I am having a hard find figuring out whether it is possible to route the OPAMP outputs internally to the corresponding ADC without wasting uC pins. Do you know if this is possible? I am using the B-G431B-ESC1 board.

Dear @EGran.2​ 

As you can see in the following posts that is done:

only 2 days after the MC-SDK team has been informed, a patch has been produced.

Do not hesitate to open other posts if you have issues with MC-SDK.

Please note that for any HW bugs on this evaluation board, you should better contact the service providing this board.

Best regards

Laurent Ca...

Dear @DB.7ERGANTIN​ 

Many thanks for your support and for your reactivity!

That is impressive!

As this post can help many people, I am coming to pin this post on top of "STM32 Motor Control" forum.

Best regards

Laurent Ca...

Laurent Ca...
Lead II

Dear all

Since this thread seems very important and in order to keep its efficiency and its usefulness for the whole "STM32 Motor Control" community, I ask to everyone to not adding any new comments on this thread.

This thread is now pinned on top on "STM32 Motor Control" forum.

Even in case of your problem is very similar to this ones, please therefor open a new post about your issues.

Please note that for any HW bugs on this evaluation board, you should better contact the service providing this board.

Best regards

Laurent Ca...