Skip to main content
nik8540
Associate
September 11, 2020
Solved

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

  • September 11, 2020
  • 29 replies
  • 6644 views

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.

This topic has been closed for replies.
Best answer by DBE

Hello,

Please find attached an unofficial motor profiler firmware for G4 Y revision and tested on a Y revision with several motors including a 7 pair-1700KV. The official one should be released with the next MCSDK. Then Close your motor profiler GUI, go to C:\Program Files (x86)\STMicroelectronics\MC_SDK_5.4.4\Utilities\PC_Software\STMotorProfiler\resources\assets\fws directory (in general this where the MCSDK is installed) and replace your B-G431B-ESC1#B-G431B-ESC1 3Sh*.hex by the one attached.

Please find also a fix to add to your B-G431B-ESC1 (still for G4 Y revision), replace your r3_2_g4xx_pwm_curr_fdbk.c in <myPrj>\MCSDK_v5.4.4\MotorControl\MCSDK\MCLib\G4xx\Src by the one attached. Open your mc_tasks.c in <myPrj>\Src and look for FOC_CurrControllerM1 routine, then cut RCM_ReadOngoingConv(); and place it before RCM_ExecNextConv(); . These fixes should be also released in the next delivery.

Best regards

29 replies

DBE
ST Employee
September 25, 2020

​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
September 25, 2020

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
September 25, 2020

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
September 25, 2020

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
September 25, 2020

​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
September 25, 2020

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.

Laurent Ca...
Senior III
September 25, 2020

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...